mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #1992: Escape ampersand in caption of menus and tabs, preventing underlined hotkey generation for names of session, database and tables
This commit is contained in:
@ -424,6 +424,7 @@ type
|
|||||||
function WebColorStrToColorDef(WebColor: string; Default: TColor): TColor;
|
function WebColorStrToColorDef(WebColor: string; Default: TColor): TColor;
|
||||||
function UserAgent(OwnerComponent: TComponent): String;
|
function UserAgent(OwnerComponent: TComponent): String;
|
||||||
function CodeIndent(Steps: Integer=1): String;
|
function CodeIndent(Steps: Integer=1): String;
|
||||||
|
function EscapeHotkeyPrefix(Text: String): String;
|
||||||
|
|
||||||
var
|
var
|
||||||
AppSettings: TAppSettings;
|
AppSettings: TAppSettings;
|
||||||
@ -3011,6 +3012,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function EscapeHotkeyPrefix(Text: String): String;
|
||||||
|
begin
|
||||||
|
// Issue #1992: Escape ampersand in caption of menus and tabs, preventing underlined hotkey generation
|
||||||
|
Result := StringReplace(Text, Vcl.Menus.cHotkeyPrefix, Vcl.Menus.cHotkeyPrefix + Vcl.Menus.cHotkeyPrefix, [rfReplaceAll]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ Get SID of current Windows user, probably useful in the future
|
{ Get SID of current Windows user, probably useful in the future
|
||||||
function GetCurrentUserSID: string;
|
function GetCurrentUserSID: string;
|
||||||
type
|
type
|
||||||
|
@ -3069,7 +3069,7 @@ begin
|
|||||||
AppSettings.GetSessionPaths('', SessionPaths);
|
AppSettings.GetSessionPaths('', SessionPaths);
|
||||||
for i:=0 to SessionPaths.Count-1 do begin
|
for i:=0 to SessionPaths.Count-1 do begin
|
||||||
item := TMenuItem.Create(menuConnections);
|
item := TMenuItem.Create(menuConnections);
|
||||||
item.Caption := SessionPaths[i];
|
item.Caption := EscapeHotkeyPrefix(SessionPaths[i]);
|
||||||
item.OnClick := SessionConnect;
|
item.OnClick := SessionConnect;
|
||||||
for Connection in Connections do begin
|
for Connection in Connections do begin
|
||||||
if SessionPaths[i] = Connection.Parameters.SessionPath then begin
|
if SessionPaths[i] = Connection.Parameters.SessionPath then begin
|
||||||
@ -3096,7 +3096,7 @@ begin
|
|||||||
AppSettings.GetSessionPaths('', SessionPaths);
|
AppSettings.GetSessionPaths('', SessionPaths);
|
||||||
for i:=0 to SessionPaths.Count-1 do begin
|
for i:=0 to SessionPaths.Count-1 do begin
|
||||||
Item := TMenuItem.Create(menuConnectTo);
|
Item := TMenuItem.Create(menuConnectTo);
|
||||||
Item.Caption := SessionPaths[i];
|
Item.Caption := EscapeHotkeyPrefix(SessionPaths[i]);
|
||||||
Item.OnClick := SessionConnect;
|
Item.OnClick := SessionConnect;
|
||||||
for Connection in Connections do begin
|
for Connection in Connections do begin
|
||||||
if SessionPaths[i] = Connection.Parameters.SessionPath then begin
|
if SessionPaths[i] = Connection.Parameters.SessionPath then begin
|
||||||
@ -12855,6 +12855,8 @@ begin
|
|||||||
// Some cases pass -1 which triggers a "List index out of bounds" in below cast
|
// Some cases pass -1 which triggers a "List index out of bounds" in below cast
|
||||||
if PageIndex = -1 then
|
if PageIndex = -1 then
|
||||||
Exit;
|
Exit;
|
||||||
|
// Escape hotkey accelerator in name of session, database or table
|
||||||
|
Text := EscapeHotkeyPrefix(Text);
|
||||||
Text := StrEllipsis(Text, 70);
|
Text := StrEllipsis(Text, 70);
|
||||||
// Special case if passed text is empty: Reset query tab caption to "Query #123"
|
// Special case if passed text is empty: Reset query tab caption to "Query #123"
|
||||||
if (PageIndex = tabQuery.PageIndex) and (Text = '') then
|
if (PageIndex = tabQuery.PageIndex) and (Text = '') then
|
||||||
|
Reference in New Issue
Block a user