mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 01:56:36 +08:00
Cosmetic: Reset query tab caption to "Query #x" on Ctrl+W ("Clear editor"), so a filename is no longer kept in that case.
This commit is contained in:
@ -1950,9 +1950,11 @@ procedure TMainForm.actClearEditorExecute(Sender: TObject);
|
||||
var
|
||||
m: TSynMemo;
|
||||
begin
|
||||
if Sender = actClearQueryEditor then
|
||||
m := ActiveQueryMemo
|
||||
else begin
|
||||
if Sender = actClearQueryEditor then begin
|
||||
m := ActiveQueryMemo;
|
||||
if QueryTabActive then
|
||||
SetTabCaption(PageControlMain.ActivePageIndex, '');
|
||||
end else begin
|
||||
m := SynMemoFilter;
|
||||
editFilterSearch.Clear;
|
||||
end;
|
||||
@ -9139,7 +9141,7 @@ begin
|
||||
QueryTab.CloseButton.Flat := True;
|
||||
QueryTab.CloseButton.PngImage := PngImageListMain.PngImages[134].PngImage;
|
||||
QueryTab.CloseButton.OnMouseUp := CloseButtonOnMouseUp;
|
||||
SetTabCaption(QueryTab.TabSheet.PageIndex, 'Query #'+IntToStr(i));
|
||||
SetTabCaption(QueryTab.TabSheet.PageIndex, '');
|
||||
|
||||
// Dumb code which replicates all controls from tabQuery
|
||||
QueryTab.pnlMemo := TPanel.Create(QueryTab.TabSheet);
|
||||
@ -9509,9 +9511,15 @@ end;
|
||||
|
||||
procedure TMainForm.SetTabCaption(PageIndex: Integer; Text: String);
|
||||
begin
|
||||
// Special case if passed text is empty: Reset query tab caption to "Query #123"
|
||||
if (PageIndex = tabQuery.PageIndex) and (Text = '') then
|
||||
Text := 'Query';
|
||||
if IsQueryTab(PageIndex, False) then begin
|
||||
if Text = '' then
|
||||
Text := 'Query #'+IntToStr(PageIndex-tabQuery.PageIndex);
|
||||
// Leave space for close button on closable query tabs
|
||||
if IsQueryTab(PageIndex, False) then
|
||||
Text := Text + ' ';
|
||||
end;
|
||||
PageControlMain.Pages[PageIndex].Caption := Text;
|
||||
FixQueryTabCloseButtons;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user