Skip to content

Commit

Permalink
Add option to support completion proposal with matching in middle of …
Browse files Browse the repository at this point in the history
…entered text. Closes HeidiSQL#126
  • Loading branch information
ansgarbecker committed Apr 12, 2020
1 parent bce6796 commit 3a29a20
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
5 changes: 4 additions & 1 deletion out/locale/en/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2020-04-05 13:09+0200\n"
"PO-Revision-Date: 2020-04-12 15:03+0200\n"
"Last-Translator: Ansgar Becker <[email protected]>\n"
"Language-Team: English (http:https://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -6453,3 +6453,6 @@ msgstr "Note: The database file will not get deleted."

msgid "Show SQL completion proposal"
msgstr "Show SQL completion proposal"

msgid "Find matches in middle of entered text"
msgstr "Find matches in middle of entered text"
3 changes: 2 additions & 1 deletion source/apphelpers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ TQueryThread = class(TThread)
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asMySQLBinaries, asCustomSnippetsDirectory,
asPromptSaveFileOnTabClose, asRestoreTabs, asWarnUnsafeUpdates, asQueryWarningsMessage,
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asCompletionProposal, asCompletionProposalSearchOnMid, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme, asIconPack, asWebSearchBaseUrl,
asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors,
Expand Down Expand Up @@ -3655,6 +3655,7 @@ constructor TAppSettings.Create;
InitSetting(asWarnUnsafeUpdates, 'WarnUnsafeUpdates', 0, True);
InitSetting(asQueryWarningsMessage, 'QueryWarningsMessage', 0, True);
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
InitSetting(asCompletionProposalSearchOnMid, 'CompletionProposalSearchOnMid', 0, False);
InitSetting(asCompletionProposalWidth, 'CompletionProposalWidth', 350);
InitSetting(asCompletionProposalNbLinesInWindow,'CompletionProposalNbLinesInWindow', 12);
InitSetting(asAutoUppercase, 'AutoUppercase', 0, True);
Expand Down
5 changes: 5 additions & 0 deletions source/main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11782,6 +11782,11 @@ procedure TMainform.SetupSynEditors;
Attri.Background := AppSettings.ReadInt(asHighlighterBackground, Attri.Name, Attri.Background);
Attri.IntegerStyle := AppSettings.ReadInt(asHighlighterStyle, Attri.Name, Attri.IntegerStyle);
end;
// Completion proposal
if AppSettings.ReadBool(asCompletionProposalSearchOnMid) then
SynCompletionProposal.Options := SynCompletionProposal.Options + [scoLimitToMatchedTextAnywhere]
else
SynCompletionProposal.Options := SynCompletionProposal.Options - [scoLimitToMatchedTextAnywhere];
end;


Expand Down
16 changes: 13 additions & 3 deletions source/options.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,11 @@ object optionsform: Toptionsform
object chkCompletionProposal: TCheckBox
Left = 180
Top = 87
Width = 508
Width = 158
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Enable autocompletion'
TabOrder = 8
OnClick = Modified
OnClick = chkCompletionProposalClick
end
object chkTabsToSpaces: TCheckBox
Left = 254
Expand Down Expand Up @@ -819,6 +818,17 @@ object optionsform: Toptionsform
Items.Strings = (
'Current custom settings')
end
object chkCompletionProposalSearchOnMid: TCheckBox
Left = 331
Top = 87
Width = 357
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Find matches in middle of entered text'
Enabled = False
TabOrder = 18
OnClick = Modified
end
end
object tabGridFormatting: TTabSheet
Caption = 'Grid formatting'
Expand Down
10 changes: 10 additions & 0 deletions source/options.pas
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ Toptionsform = class(TExtForm)
lblWebSearchBaseUrl: TLabel;
comboWebSearchBaseUrl: TComboBox;
chkThemePreview: TCheckBox;
chkCompletionProposalSearchOnMid: TCheckBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
Expand Down Expand Up @@ -213,6 +214,7 @@ Toptionsform = class(TExtForm)
procedure comboThemeSelect(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure chkThemePreviewClick(Sender: TObject);
procedure chkCompletionProposalClick(Sender: TObject);
private
{ Private declarations }
FWasModified: Boolean;
Expand Down Expand Up @@ -374,6 +376,7 @@ procedure Toptionsform.Apply(Sender: TObject);
end;

AppSettings.WriteBool(asCompletionProposal, chkCompletionProposal.Checked);
AppSettings.WriteBool(asCompletionProposalSearchOnMid, chkCompletionProposalSearchOnMid.Checked);
AppSettings.WriteBool(asAutoUppercase, chkAutoUppercase.Checked);
AppSettings.WriteBool(asTabsToSpaces, chkTabsToSpaces.Checked);

Expand Down Expand Up @@ -681,6 +684,7 @@ procedure Toptionsform.FormShow(Sender: TObject);
updownSQLFontSize.Position := SynMemoSQLSample.Font.Size;
updownSQLTabWidth.Position := SynMemoSQLSample.TabWidth;
chkCompletionProposal.Checked := AppSettings.ReadBool(asCompletionProposal);
chkCompletionProposalSearchOnMid.Checked := AppSettings.ReadBool(asCompletionProposalSearchOnMid);
chkAutoUppercase.Checked := AppSettings.ReadBool(asAutoUppercase);
chkTabsToSpaces.Checked := AppSettings.ReadBool(asTabsToSpaces);
comboSQLColElementChange(Sender);
Expand Down Expand Up @@ -845,6 +849,12 @@ procedure Toptionsform.chkUpdatecheckClick(Sender: TObject);
end;


procedure Toptionsform.chkCompletionProposalClick(Sender: TObject);
begin
chkCompletionProposalSearchOnMid.Enabled := TCheckBox(Sender).Checked;
Modified(Sender);
end;

procedure Toptionsform.chkLogToFileClick(Sender: TObject);
begin
editLogDir.Enabled := TCheckBox(Sender).Checked;
Expand Down

0 comments on commit 3a29a20

Please sign in to comment.