diff --git a/tools/cmd/at/main.go b/tools/cmd/at/main.go index 3406693d3..6b331cefe 100644 --- a/tools/cmd/at/main.go +++ b/tools/cmd/at/main.go @@ -256,7 +256,7 @@ func get_password(password string, password_file string, password_env string, us if ans == "" && password_file != "" { if password_file == "-" { if tty.IsTerminal(os.Stdin.Fd()) { - ans, err = tui.ReadPassword("Password: ", false) + ans, err = tui.ReadPassword("Password: ", true) if err != nil { return } diff --git a/tools/tui/key-encoding.go b/tools/tui/key-encoding.go index 2ea85d834..0f68f9621 100644 --- a/tools/tui/key-encoding.go +++ b/tools/tui/key-encoding.go @@ -217,14 +217,14 @@ func (self *ParsedShortcut) String() string { return ans } -var parsed_shortcut_cache map[string]ParsedShortcut +var parsed_shortcut_cache map[string]*ParsedShortcut func ParseShortcut(spec string) *ParsedShortcut { if parsed_shortcut_cache == nil { - parsed_shortcut_cache = make(map[string]ParsedShortcut, 128) + parsed_shortcut_cache = make(map[string]*ParsedShortcut, 128) } if val, ok := parsed_shortcut_cache[spec]; ok { - return &val + return val } ospec := spec if strings.HasSuffix(spec, "+") { @@ -243,7 +243,6 @@ func ParseShortcut(spec string) *ParsedShortcut { } } ans := ParsedShortcut{KeyName: key_name} - parsed_shortcut_cache[spec] = ans if len(parts) > 1 { for _, q := range parts[:len(parts)-1] { val, ok := kitty.ConfigModMap[strings.ToUpper(q)] @@ -254,6 +253,7 @@ func ParseShortcut(spec string) *ParsedShortcut { } } } + parsed_shortcut_cache[spec] = &ans return &ans } diff --git a/tools/tui/password.go b/tools/tui/password.go index 719ee8aa5..dc30e043b 100644 --- a/tools/tui/password.go +++ b/tools/tui/password.go @@ -24,7 +24,10 @@ func ReadPassword(prompt string, kill_if_signaled bool) (password string, err er return } - loop.OnInitialize = func(loop *Loop) string { return "\r\n" } + loop.OnInitialize = func(loop *Loop) string { + loop.QueueWriteString(prompt) + return "\r\n" + } loop.OnText = func(loop *Loop, text string, from_key_event bool, in_bracketed_paste bool) error { old_width := wcswidth.Stringwidth(password)