From 2efb402faeb0d9cec3adc7b3d1f35cc4db893028 Mon Sep 17 00:00:00 2001 From: Maurilio Longo Date: Sat, 21 Apr 2001 21:03:48 +0000 Subject: [PATCH] 2001-04-21 22:59 GMT+2 Maurilio Longo * source/rtl/memoedit.prg ! fixed error when UserFunction is a logical value. --- harbour/ChangeLog | 10 +++++++--- harbour/source/rtl/memoedit.prg | 14 ++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8bb56ee70d..18a2e33610 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +2001-04-21 22:59 GMT+2 Maurilio Longo + * source/rtl/memoedit.prg + ! fixed error when UserFunction is a logical value. + 2001-04-20 18:15 UTC-0400 David G. Holm * source/rtl/disksphb.c @@ -30,7 +34,7 @@ 2001-04-20 16:30 CET Martin Vogel + contrib/libct/charop.c - + charadd(), charand(), charor(), charxor(), charnot() and + + charadd(), charand(), charor(), charxor(), charnot() and (NEW!) charsub(), charshl(), charshr(), charrll() and charrlr() functions * contrib/libct/Makefile @@ -41,7 +45,7 @@ * contrib/libct/makefile.vc + added contrib/libct/charop.c - + * contrib/libct/ctflist.txt * changed status of functions mentioned above @@ -58,7 +62,7 @@ + contrib/libct/tests/charshr.prg + contrib/libct/tests/charrll.prg + contrib/libct/tests/charrlr.prg - ! small test programs for new functions + ! small test programs for new functions * contrib/libct/tests/Makefile + added contrib/libct/tests/charadd.prg diff --git a/harbour/source/rtl/memoedit.prg b/harbour/source/rtl/memoedit.prg index 9fdd39cb46..01ca386262 100644 --- a/harbour/source/rtl/memoedit.prg +++ b/harbour/source/rtl/memoedit.prg @@ -81,7 +81,7 @@ METHOD MemoInit(cUserFunction) CLASS TMemoEditor // Save/Init object internal representation of user function ::xUserFunction := cUserFunction - if ::xUserFunction <> nil + if ISCHARACTER(::xUserFunction) // Keep calling user function until it returns 0 while (nKey := Do(::xUserFunction, ME_INIT, ::nRow, ::nCol - 1)) <> ME_DEFAULT @@ -107,7 +107,7 @@ METHOD Edit() CLASS TMemoEditor // If I have an user function I need to trap configurable keys and ask to // user function if handle them the standard way or not - if ::lEditAllow .AND. ::xUserFunction <> nil + if ::lEditAllow .AND. ISCHARACTER(::xUserFunction) while ! ::lExitEdit @@ -147,7 +147,7 @@ METHOD KeyboardHook(nKey) CLASS TMemoEditor local nUserKey - if ::xUserFunction <> nil + if ISCHARACTER(::xUserFunction) nUserKey := Do(::xUserFunction, iif(::lDirty, ME_UNKEYX, ME_UNKEY), ::nRow, ::nCol - 1) ::HandleUserKey(nKey, nUserKey) @@ -159,7 +159,7 @@ return Self METHOD IdleHook() CLASS TMemoEditor - if ::xUserFunction <> nil + if ISCHARACTER(::xUserFunction) Do(::xUserFunction, ME_IDLE, ::nRow, ::nCol - 1) endif @@ -243,8 +243,10 @@ FUNCTION MemoEdit(cString,; DEFAULT cUserFunction TO nil DEFAULT cString TO "" - // Original MemoEdit() converts Tabs into spaces - oEd := TMemoEditor():New(StrTran(cString, Chr(K_TAB), Space(1)), nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabSize) + // Original MemoEdit() converts Tabs into spaces; + // TOFIX: I need to add an EOL char to fix the case where I call MemoEdit() with a string of one line without EOL. + // If I don't add an EOL I lose last char of string + oEd := TMemoEditor():New(StrTran(cString, Chr(K_TAB), Space(1)) + HB_OSNewLine(), nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabSize) oEd:MemoInit(cUserFunction) oEd:RefreshWindow()