Skip to content

Commit

Permalink
Hopefully fix slow loading tabs. Related to commit 1d1d1a4.
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarbecker committed Mar 13, 2024
1 parent 56d84c3 commit 4751e83
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions source/main.pas
Expand Up @@ -2510,8 +2510,9 @@ function TMainForm.RestoreTabs: Boolean;
SetTabCaption(Tab.TabSheet.PageIndex, TabCaption);
if EditorHeight > 50 then
Tab.pnlMemo.Height := EditorHeight;
if HelpersWidth > 50 then
Tab.pnlHelpers.Width := HelpersWidth;
// Causes sporadic long-waiters:
//if HelpersWidth > 50 then
// Tab.pnlHelpers.Width := HelpersWidth;
Tab.ListBindParams.AsText := BindParams;
Tab.BindParamsActivated := Tab.ListBindParams.Count > 0;
Tab.Memo.TopLine := EditorTopLine;
Expand All @@ -2532,8 +2533,9 @@ function TMainForm.RestoreTabs: Boolean;
SetTabCaption(Tab.TabSheet.PageIndex, TabCaption);
if EditorHeight > 50 then
Tab.pnlMemo.Height := EditorHeight;
if HelpersWidth > 50 then
Tab.pnlHelpers.Width := HelpersWidth;
// Causes sporadic long-waiters:
//if HelpersWidth > 50 then
// Tab.pnlHelpers.Width := HelpersWidth;
Tab.ListBindParams.AsText := BindParams;
Tab.BindParamsActivated := Tab.ListBindParams.Count > 0;
Tab.Memo.TopLine := EditorTopLine;
Expand Down Expand Up @@ -14782,10 +14784,9 @@ function TQueryTab.LoadContents(Filepath: String; ReplaceContent: Boolean; Encod
if Pos(AppSettings.DirnameSnippets, Filepath) = 0 then
MainForm.AddOrRemoveFromQueryLoadHistory(Filepath, True, True);
Memo.UndoList.AddGroupBreak;
Memo.BeginUpdate;
LineBreaks := ScanLineBreaks(Content);
if ReplaceContent then begin
Memo.SelectAll;
Memo.Clear;
MemoLineBreaks := LineBreaks;
end else begin
if (MemoLineBreaks <> lbsNone) and (MemoLineBreaks <> LineBreaks) then
Expand All @@ -14796,9 +14797,11 @@ function TQueryTab.LoadContents(Filepath: String; ReplaceContent: Boolean; Encod
if MemoLineBreaks = lbsMixed then
MessageDialog(_('This file contains mixed linebreaks. They have been converted to Windows linebreaks (CR+LF).'), mtInformation, [mbOK]);

Memo.SelText := Content;
if ReplaceContent then
Memo.Text := Content
else
Memo.SelText := Content;
Memo.SelStart := Memo.SelEnd;
Memo.EndUpdate;
Memo.Modified := False;
MemoFilename := Filepath;
Result := True;
Expand Down

0 comments on commit 4751e83

Please sign in to comment.