SynEdit: fix line-change indicator, when adding new lines (without breaking the current line). Issue #30152

This commit is contained in:
Martin 2023-06-21 01:44:46 +02:00
parent 81f407e030
commit a77a04cc4c

View File

@ -1501,15 +1501,22 @@ end;
procedure TSynEditStringList.EditLineBreak(LogX, LogY: Integer); procedure TSynEditStringList.EditLineBreak(LogX, LogY: Integer);
var var
s: string; s: string;
ModEnd, ModStart: Integer;
begin begin
IncIsInEditAction; IncIsInEditAction;
if Count = 0 then Add(''); if Count = 0 then Add('');
s := Strings[LogY - 1]; s := Strings[LogY - 1];
ModStart := LogY;
ModEnd := LogY + 1;
if LogX = 1 then
dec(ModEnd);
if LogX - 1 < length(s) then if LogX - 1 < length(s) then
Strings[LogY - 1] := copy(s, 1, LogX - 1); Strings[LogY - 1] := copy(s, 1, LogX - 1)
else
inc(ModStart);
Insert(LogY, copy(s, LogX, length(s))); Insert(LogY, copy(s, LogX, length(s)));
CurUndoList.AddChange(TSynEditUndoTxtLineBreak.Create(LogY)); CurUndoList.AddChange(TSynEditUndoTxtLineBreak.Create(LogY));
MarkModified(LogY, LogY + 1); MarkModified(ModStart, ModEnd);
SendNotification(senrEditAction, self, LogY, 1, LogX, 0, ''); SendNotification(senrEditAction, self, LogY, 1, LogX, 0, '');
DecIsInEditAction; DecIsInEditAction;
end; end;