mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-21 16:05:02 +02:00
More misc fixes for TUI
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user