SynEdit: Fixes DelToEndOfWord if Caret past EOL (Bug #10739) and fix DelChar with UTF8 and Caret past EOL

git-svn-id: trunk@17998 -
This commit is contained in:
martin 2008-12-30 13:53:48 +00:00
parent f0624f81c8
commit 5de189d7af
2 changed files with 8 additions and 10 deletions

View File

@ -6948,12 +6948,8 @@ begin
end else begin
// join line with the line after
if CaretY < Lines.Count then begin
Helper := StringOfChar(' ', CaretX - 1 - Len);
{$IFDEF SYN_LAZARUS}
Helper := StringOfChar(' ', LogCaretXY.X - 1 - Len);
Lines[CaretY - 1] := Temp + Helper + Lines[CaretY];
{$ELSE}
TrimmedSetLine(CaretY - 1, Temp + Helper + Lines[CaretY]);
{$ENDIF}
Caret := Point(1, CaretY + 1);
Helper := {$IFDEF SYN_LAZARUS}LineEnding{$ELSE}#13#10{$ENDIF};
Lines.Delete(CaretY);
@ -6969,18 +6965,17 @@ begin
end;
ecDeleteWord, ecDeleteEOL:
if not ReadOnly then begin
{$IFDEF SYN_LAZARUS}
Len := LogicalToPhysicalCol(LineText,Length(LineText)+1)-1;
{$ELSE}
Len := Length(LineText);
{$ENDIF}
Helper := '';
if Command = ecDeleteWord then begin
if CaretX > Len + 1 then
CaretX := Len + 1;
Helper := StringOfChar(' ', CaretX - 1 - Len);
WP := NextWordPos{$IFDEF SYN_LAZARUS}(True){$ENDIF};
end else
WP := Point(Len + 1, CaretY);
if (WP.X <> CaretX) or (WP.Y <> CaretY) then begin
if Helper <> '' then
LineText := LineText + Helper;
OldSelMode := FBlockSelection.ActiveSelectionMode;
try
SetBlockBegin(PhysicalToLogicalPos(WP));

View File

@ -778,6 +778,9 @@ begin
EndInsert.x := Length(FLines[EndInsert.y - 1]);
end;
end;
if ChangeReason in [crSilentDelete, crSilentDeleteAfterCursor, crDelete,
crDeleteAfterCursor] then
ChangeReason := crInsert;
fUndoList.AddChange(ChangeReason, StartInsert, EndInsert, '', PasteMode);
end;
StartLineBytePos := FCaret.LineBytePos; // reset selection