From: Andreas H. <ah...@us...> - 2005-12-15 16:15:13
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12588/run Modified Files: JvEditor.pas JvUnicodeEditor.pas Log Message: Fixed Mantis #3365: JVHLEditor - 'List index out of bound' after pressing backspace Index: JvUnicodeEditor.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvUnicodeEditor.pas,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** JvUnicodeEditor.pas 15 Sep 2005 10:19:43 -0000 1.49 --- JvUnicodeEditor.pas 15 Dec 2005 16:15:01 -0000 1.50 *************** *** 1219,1223 **** if X > 0 then begin ! // in the middle of line - â ñåðåäèíå ñòðîêè if (not PersistentBlocks) and FSelection.IsSelected then DoAndCorrectXY(RemoveSelectedBlock) --- 1219,1223 ---- if X > 0 then begin ! // in the middle of line if (not PersistentBlocks) and FSelection.IsSelected then DoAndCorrectXY(RemoveSelectedBlock) *************** *** 1253,1281 **** if Y > 0 then begin ! LockUpdate; ! try ! //{ at begin of line - â íà÷àëå ñòðîêè} ! RemoveSelectedBlock; ! ReLine; ! ! X := Length(FLines[Y - 1]); ! { --- UNDO --- } ! TJvBackspaceUndo.Create(Self, X + 1, CaretY - 1, Lf); ! CaretUndo := False; ! { --- /UNDO --- } ! // persistent blocks: adjust selection ! AdjustPersistentBlockSelection(CaretX, CaretY, amLineConcat, [X, CaretY - 1]); ! FLines.DeleteText(X, Y - 1, -1, Y); ! Dec(Y); ! finally ! UnlockUpdate; end; - UpdateEditorSize; - TextModified(X, Y, maDelete, sLineBreak); - Invalidate; - Changed; end; ecDelete: --- 1253,1291 ---- if Y > 0 then begin ! // at the start of line ! if FSelection.IsSelected then ! begin ! BeginCompound; ! try ! DoAndCorrectXY(RemoveSelectedBlock); ! ReLine; ! finally ! EndCompound; ! end; ! end ! else ! begin ! LockUpdate; ! try ! X := Length(FLines[Y - 1]); ! { --- UNDO --- } ! TJvBackspaceUndo.Create(Self, X + 1, CaretY - 1, Lf); ! CaretUndo := False; ! { --- /UNDO --- } ! // persistent blocks: adjust selection ! AdjustPersistentBlockSelection(CaretX, CaretY, amLineConcat, [X, CaretY - 1]); ! FLines.DeleteText(X, Y - 1, -1, Y); ! Dec(Y); ! finally ! UnlockUpdate; ! end; ! UpdateEditorSize; ! TextModified(X, Y, maDelete, sLineBreak); ! Invalidate; ! Changed; end; end; ecDelete: Index: JvEditor.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvEditor.pas,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** JvEditor.pas 15 Sep 2005 10:19:42 -0000 1.73 --- JvEditor.pas 15 Dec 2005 16:15:01 -0000 1.74 *************** *** 1223,1228 **** if X > 0 then begin ! // in the middle of line - â ñåðåäèíå ñòðîêè ! if (not PersistentBlocks) and (FSelection.IsSelected) then DoAndCorrectXY(RemoveSelectedBlock) else --- 1223,1228 ---- if X > 0 then begin ! // in the middle of line ! if not PersistentBlocks and FSelection.IsSelected then DoAndCorrectXY(RemoveSelectedBlock) else *************** *** 1257,1285 **** if Y > 0 then begin ! LockUpdate; ! try ! //{ at begin of line - â íà÷àëå ñòðîêè} ! RemoveSelectedBlock; ! ReLine; ! ! X := Length(FLines[Y - 1]); ! { --- UNDO --- } ! TJvBackspaceUndo.Create(Self, X + 1, CaretY - 1, Lf); ! CaretUndo := False; ! { --- /UNDO --- } ! // persistent blocks: adjust selection ! AdjustPersistentBlockSelection(CaretX, CaretY, amLineConcat, [X, CaretY - 1]); ! FLines.DeleteText(X, Y - 1, -1, Y); ! Dec(Y); ! finally ! UnlockUpdate; end; - UpdateEditorSize; - TextModified(X, Y, maDelete, sLineBreak); - Invalidate; - Changed; end; ecDelete: --- 1257,1295 ---- if Y > 0 then begin ! // at the start of line ! if FSelection.IsSelected then ! begin ! BeginCompound; ! try ! DoAndCorrectXY(RemoveSelectedBlock); ! ReLine; ! finally ! EndCompound; ! end; ! end ! else ! begin ! LockUpdate; ! try ! X := Length(FLines[Y - 1]); ! { --- UNDO --- } ! TJvBackspaceUndo.Create(Self, X + 1, CaretY - 1, Lf); ! CaretUndo := False; ! { --- /UNDO --- } ! // persistent blocks: adjust selection ! AdjustPersistentBlockSelection(CaretX, CaretY, amLineConcat, [X, CaretY - 1]); ! FLines.DeleteText(X, Y - 1, -1, Y); ! Dec(Y); ! finally ! UnlockUpdate; ! end; ! UpdateEditorSize; ! TextModified(X, Y, maDelete, sLineBreak); ! Invalidate; ! Changed; end; end; ecDelete: |