SynEdit: more precise change indicator gutter. Issue #30152

git-svn-id: trunk@52474 -
This commit is contained in:
martin 2016-06-10 21:34:50 +00:00
parent 2bdea5e7ad
commit 1c0abfedcb
2 changed files with 10 additions and 3 deletions

View File

@ -1981,13 +1981,13 @@ var
FLines.EditInsert(LogCaretXY.X, LogCaretXY.Y, Value);
FInternalCaret.BytePos := FInternalCaret.BytePos + Length(Value);
end else begin
FLines.EditLineBreak(LogCaretXY.X, LogCaretXY.Y);
if (P <> Start) or (LogCaretXY.X > 1 + length(FLines[ToIdx(LogCaretXY.Y)])) then begin
SetString(Str, Value, P - Start);
FLines.EditInsert(LogCaretXY.X, LogCaretXY.Y, Str);
end
else
Str := '';
FLines.EditLineBreak(LogCaretXY.X + (P - Start), LogCaretXY.Y);
Result := CountLines(P);
if Result > 1 then
FLines.EditLinesInsert(LogCaretXY.Y + 1, Result - 1);

View File

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