From 6e9be764fd965da021b2187dc5fd93d29aba791c Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Thu, 9 May 2024 13:03:50 +0200 Subject: [PATCH] Mark grid nodes with vsMultiLine, even if asGridRowLineCount option is set to 1. Fixes endlessly received WM_PAINT messages on results with large lines and tabs in it. Fixes issue #1897. See https://www.heidisql.com/forum.php?t=41502 --- source/apphelpers.pas | 3 ++- source/main.pas | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source/apphelpers.pas b/source/apphelpers.pas index 5c21c626..5bf28d7f 100644 --- a/source/apphelpers.pas +++ b/source/apphelpers.pas @@ -1416,7 +1416,8 @@ begin Node := VT.GetFirstInitialized; while Assigned(Node) do begin VT.NodeHeight[Node] := VT.DefaultNodeHeight; - VT.MultiLine[Node] := MultiLineCount > 1; + // Nodes have vsMultiLine through InitNode event + // VT.MultiLine[Node] := MultiLineCount > 1; Node := VT.GetNextInitialized(Node); end; VT.EndUpdate; diff --git a/source/main.pas b/source/main.pas index e744e0df..b790573e 100644 --- a/source/main.pas +++ b/source/main.pas @@ -6227,11 +6227,9 @@ procedure TMainForm.AnyGridInitNode(Sender: TBaseVirtualTree; ParentNode, Node: var Idx: PInt64; begin - // Display multiline grid rows - if AppSettings.ReadInt(asGridRowLineCount) = 1 then - Exclude(Node.States, vsMultiLine) - else - Include(Node.States, vsMultiLine); + // Mark all nodes as multiline capable. Fixes painting issues with long lines. + // See issue #1897 and https://www.heidisql.com/forum.php?t=41502 + Include(Node.States, vsMultiLine); // Node may have data already, if added via InsertRow if not (vsOnFreeNodeCallRequired in Node.States) then begin Idx := Sender.GetNodeData(Node); @@ -10241,11 +10239,14 @@ var begin if Column = -1 then Exit; + if TextType <> ttNormal then + Exit; ResultCol := Column - 1; if ResultCol < 0 then begin CellText := (Node.Index +1).ToString; Exit; end; + EditingAndFocused := Sender.IsEditing and (Node = Sender.FocusedNode) and (Column = Sender.FocusedColumn); Results := GridResult(Sender); if (Results = nil) or (not Results.Connection.Active) then begin @@ -10255,6 +10256,7 @@ begin // Happens in some crashes, see issue #2462 if ResultCol >= Results.ColumnCount then Exit; + RowNumber := Sender.GetNodeData(Node); Results.RecNo := RowNumber^; if Results.IsNull(ResultCol) and (not EditingAndFocused) then @@ -14310,6 +14312,7 @@ begin on E:Exception do ErrorDialog(E.Message); end; + Done := True; end; // Sort list tables in idle time, so ListTables.TreeOptions.AutoSort does not crash the list @@ -14317,12 +14320,14 @@ begin if (PageControlMain.ActivePage = tabDatabase) and (not FListTablesSorted) then begin ListTables.SortTree(ListTables.Header.SortColumn, ListTables.Header.SortDirection); FListTablesSorted := True; + Done := True; end; // Re-enable refresh action when application is idle if (not actRefresh.Enabled) and (FRefreshActionDisabledAt < (GetTickCount - 1000)) then begin actRefresh.Enabled := True; + Done := True; end; end;