Skip to content

Commit

Permalink
refac
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Dec 24, 2023
1 parent 27f423b commit 967f2b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 2 additions & 7 deletions app/formmain_py_api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,6 @@ var
StrText: string;
Strs: TATStrings;
bAllText: boolean;
ScrollInfo: TATEditorScrollInfo;
begin
with AppPython.Engine do
if Bool(PyArg_ParseTuple(Args, 'Liiiis:replace', @H, @X1, @Y1, @X2, @Y2, @PtrText)) then
Expand All @@ -1820,13 +1819,9 @@ begin
Shift,
PosAfter);

//reset ScrollHorz.Max, it's needed because CudaFormatter can replace long one-liner to short lines
if bAllText then
begin
//reset ScrollHorz.Max, it's needed because CudaFormatter could replace long one-liner to short lines
ScrollInfo:= Ed.ScrollHorz;
ScrollInfo.NMax:= 1;
Ed.ScrollHorz:= ScrollInfo;
end;
EditorResetHorizontalScrollbarMax(Ed);

Ed.DoEventChange(Y1);
Ed.UpdateWrapInfo(true); //fixing #4173
Expand Down
10 changes: 10 additions & 0 deletions app/proc_editor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ procedure EditorForceUpdateIfWrapped(Ed: TATSynEdit);
procedure EditorScrollToCaret(Ed: TATSynEdit; ANeedWrapOff, AllowProcessMsg: boolean);
procedure EditorCaretToView(Ed: TATSynEdit; ANeedWrapOff, AllowProcessMsg: boolean);
procedure EditorCalcOffsetsForStatusbar(Ed: TATSynEdit; out AOffsetMax, AOffsetCaret: integer);
procedure EditorResetHorizontalScrollbarMax(Ed: TATSynEdit);

type
TATEditorTempOptions = record
Expand Down Expand Up @@ -3250,6 +3251,15 @@ procedure EditorConvertIndentation(Ed: TATSynEdit; ASpacesToTabs: boolean);
end;


procedure EditorResetHorizontalScrollbarMax(Ed: TATSynEdit);
var
Info: TATEditorScrollInfo;
begin
Info:= Ed.ScrollHorz;
Info.NMax:= 1;
Ed.ScrollHorz:= Info;
end;

{ TEditorHtmlTagList }

function TEditorHtmlTagList.ItemPtr(AIndex: integer): PEditorHtmlTagRecord;
Expand Down

0 comments on commit 967f2b9

Please sign in to comment.