From 383c7d0ff01519b56cd70e1af3bcfb260980eb15 Mon Sep 17 00:00:00 2001 From: Xavi Date: Fri, 26 Mar 2010 04:05:40 +0000 Subject: [PATCH] 2010-03-26 05:05 UTC+0100 Xavi (jarabal/at/gmail.com) * harbour/src/rtl/teditor.prg ! Fixing MemoEdit K_PGDN / K_PGUP calculation. --- harbour/ChangeLog | 4 ++++ harbour/src/rtl/teditor.prg | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index df6819f425..3d3ccb2d44 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-03-26 05:05 UTC+0100 Xavi (jarabal/at/gmail.com) + * harbour/src/rtl/teditor.prg + ! Fixing MemoEdit K_PGDN / K_PGUP calculation. + 2010-03-26 00:44 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/vm/hvmall.c ! fixed typo in last commit diff --git a/harbour/src/rtl/teditor.prg b/harbour/src/rtl/teditor.prg index bdc420b6c0..32f6c219d2 100644 --- a/harbour/src/rtl/teditor.prg +++ b/harbour/src/rtl/teditor.prg @@ -461,6 +461,7 @@ METHOD LineColor( nRow ) CLASS HBEditor METHOD MoveCursor( nKey ) CLASS HBEditor LOCAL lMoveKey := .T. + LOCAL nCursor := SetCursor( SC_NONE ) DO CASE CASE nKey == K_DOWN @@ -487,9 +488,10 @@ METHOD MoveCursor( nKey ) CLASS HBEditor CASE nKey == K_PGDN IF ::nRow + ::nNumRows < ::naTextLen ::nRow += ::nNumRows - ::nFirstRow += ::nNumRows IF ::nFirstRow + ::nNumRows > ::naTextLen ::nFirstRow -= ( ( ::nFirstRow + ::nNumRows ) - ::naTextLen ) + 1 + ELSE + ::nFirstRow += ::nNumRows ENDIF ELSE ::nFirstRow := Max( ::naTextLen - ::nNumRows + 1, 1 ) @@ -503,7 +505,7 @@ METHOD MoveCursor( nKey ) CLASS HBEditor ::nCol := Max( ::LineLen( ::nRow ), 1 ) ::nFirstRow := Max( ::naTextLen - ::nNumRows + 1, 1 ) ::nFirstCol := Max( ::nCol - ::nNumCols + 1, 1 ) - ::SetPos( Min( ::nTop + ::naTextLen - 1, ::nBottom ), Min( ::nLeft + ::nCol - 1, ::nRight ) ) + ::SetPos( Min( ::nTop + ::naTextLen - 1, ::nBottom ), Min( ::nLeft + ::nCol, ::nRight ) ) ::display() CASE nKey == K_UP @@ -531,6 +533,8 @@ METHOD MoveCursor( nKey ) CLASS HBEditor ::nFirstRow -= ::nNumRows IF ::nFirstRow < 1 ::nFirstRow := 1 + ::nRow := 1 + ::SetPos( ::nTop, ::Col() ) ENDIF ELSE ::nFirstRow := 1 @@ -615,7 +619,7 @@ METHOD MoveCursor( nKey ) CLASS HBEditor IF ::nRow > ::naTextLen ::nRow := ::naTextLen ENDIF - ::nCol := Max( ::LineLen( ::nRow ), 1 ) + ::nCol := Max( ::LineLen( ::nRow ) + 1, 1 ) ::nFirstCol := Max( ::nCol - ::nNumCols + 1, 1 ) ::SetPos( Min( ::nTop + ::naTextLen - 1, ::nBottom ), Min( ::nLeft + ::nCol - 1, ::nRight ) ) ::display() @@ -625,6 +629,8 @@ METHOD MoveCursor( nKey ) CLASS HBEditor ENDCASE + SetCursor( nCursor ) + RETURN lMoveKey // Changes insert state and insertion / overstrike mode of editor @@ -1019,7 +1025,11 @@ METHOD New( cString, nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabS nWndCol := Max( 0, nWndCol ) ::nFirstRow := Max( 1, nTextRow - nWndRow ) - ::nFirstCol := Max( 1, nTextCol - nWndCol + 1 ) + ::nFirstCol := nTextCol - nWndCol + 1 + IF ::nFirstCol < 1 + nTextCol -= ::nFirstCol - 1 + ::nFirstCol := 1 + ENDIF ::nRow := Max( 1, Min( nTextRow, ::naTextLen ) ) ::nCol := Max( 1, nTextCol + 1 )