diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-15 11:14:54 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-15 11:14:54 +0200 |
commit | c0533e4dd6decd6049bcd8ef04b66fa6f743bfd0 (patch) | |
tree | 98adbc0a44f61315147e97214a10f41cbeba7a6b /src/gui | |
parent | 2f92817a1cbd52906c3e3395e9406c655903eb99 (diff) | |
download | fpGUI-c0533e4dd6decd6049bcd8ef04b66fa6f743bfd0.tar.xz |
memo CursorLine property improvements and sanity checks
* The selection variables were not updated before
* Little error checking was done, so you could get index out of
bounds errors.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fpg_memo.pas | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/fpg_memo.pas b/src/gui/fpg_memo.pas index 41587135..789da3c3 100644 --- a/src/gui/fpg_memo.pas +++ b/src/gui/fpg_memo.pas @@ -246,13 +246,18 @@ var MaxLine: integer; yp: integer; begin - if (aValue < 0) or (aValue = FCursorLine) then + if (aValue < 0) or (aValue = FCursorLine) or (AValue > FLines.Count-1) then Exit; // wrong value + if aValue < FFirstLine then begin FFirstLine := aValue; // moves the selected line to the top of the displayed rectangle FCursorLine := aValue; FCursorPos := 0; + FSelStartPos := FCursorPos; + FSelStartLine := FCursorLine; + FSelEndLine := -1; + AdjustCursor; RePaint; Exit; end; @@ -272,15 +277,21 @@ begin FFirstLine := aValue; FCursorLine := aValue; FCursorPos := 0; + FSelStartPos := FCursorPos; + FSelStartLine := FCursorLine; + FSelEndLine := -1; + AdjustCursor; RePaint; - Exit; end else begin FCursorLine := aValue; FCursorPos := 0; + FSelStartPos := FCursorPos; + FSelStartLine := FCursorLine; + FSelEndLine := -1; + AdjustCursor; RePaint; - Exit; end; end; |