Skip to content

Commit 676fcd7

Browse files
committed
fix: high CPU load and unresponsiveness through SynEdit highlighter when starting to edit large text in popup editor
Refs #2388
1 parent 2acce35 commit 676fcd7

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

extra/locale/heidisql.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: HeidiSQL\n"
99
"POT-Creation-Date: 2012-11-05 21:40\n"
10-
"PO-Revision-Date: 2026-02-19 18:41+0100\n"
10+
"PO-Revision-Date: 2026-02-22 16:29+0100\n"
1111
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
1212
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
1313
"Language: en\n"
@@ -6648,8 +6648,8 @@ msgstr "Style:"
66486648
msgid "Error in code formatting: %s"
66496649
msgstr "Error in code formatting: %s"
66506650

6651-
msgid "Auto-disabling wordwrap for large text"
6652-
msgstr "Auto-disabling wordwrap for large text"
6651+
msgid "Auto-disabling wordwrap and syntax highlighter for large text"
6652+
msgstr "Auto-disabling wordwrap and syntax highlighter for large text"
66536653

66546654
msgid "%d tab(s) took longer than expected to restore. Closing and reopening these should fix that: %s"
66556655
msgstr "%d tab(s) took longer than expected to restore. Closing and reopening these should fix that: %s"

source/grideditlinks.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ function TInplaceEditorLink.BeginEdit: Boolean;
12241224
if Result then begin
12251225
FButton.Visible := ButtonVisible;
12261226
SetBounds(Rect(0, 0, 0, 0));
1227-
if (Length(FEdit.Text) > SIZE_KB) or (ScanLineBreaks(FEdit.Text) <> lbsNone) then
1227+
if (Length(FEdit.Text) >= GRIDMAXDATA) or (ScanLineBreaks(FEdit.Text) <> lbsNone) then
12281228
ButtonClick(FTree)
12291229
else begin
12301230
FPanel.Show;

source/texteditor.pas

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,15 @@ procedure TfrmTextEditor.SetText(text: String);
141141
end;
142142
if Assigned(Detected) then
143143
SelectLineBreaks(Detected);
144-
if (Length(text) > SIZE_MB) then begin
145-
MainForm.LogSQL(_('Auto-disabling wordwrap for large text'));
144+
if (Length(text) > SIZE_KB*10) then begin
145+
MainForm.LogSQL(_('Auto-disabling wordwrap and syntax highlighter for large text'));
146146
btnWrap.Enabled := False;
147+
comboHighlighter.Enabled := False;
148+
btnCustomizeHighlighter.Enabled := False;
147149
end else begin
148150
btnWrap.Enabled := True;
151+
comboHighlighter.Enabled := True;
152+
btnCustomizeHighlighter.Enabled := True;
149153
end;
150154

151155
MemoText.Text := text;
@@ -379,6 +383,8 @@ procedure TfrmTextEditor.comboHighlighterSelect(Sender: TObject);
379383
SelStart, SelLength: Integer;
380384
begin
381385
// Code highlighter selected
386+
if not comboHighlighter.Enabled then
387+
Exit;
382388
SelStart := MemoText.SelStart;
383389
SelLength := MemoText.SelEnd - MemoText.SelStart;
384390
MemoText.Highlighter := nil;

0 commit comments

Comments
 (0)