From 4751e8308092c84b0b8512c5891c474a65f50a45 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Wed, 13 Mar 2024 15:37:42 +0100 Subject: [PATCH] Hopefully fix slow loading tabs. Related to commit 1d1d1a493892eba9152a868bc303a11c1826af74. --- source/main.pas | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/source/main.pas b/source/main.pas index c7c58b63..60b8efc2 100644 --- a/source/main.pas +++ b/source/main.pas @@ -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; @@ -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; @@ -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 @@ -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;