mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 23:16:01 +02:00
SynEdit: fix line-change indicator, when adding new lines (without breaking the current line). Issue #30152
This commit is contained in:
parent
81f407e030
commit
a77a04cc4c
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user