Cleanup previous PR

Also fix ask kitten not setting window title in modes other than choose
This commit is contained in:
Kovid Goyal
2026-03-05 11:19:40 +05:30
parent f89617893f
commit 50bc3f465e
5 changed files with 18 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/kovidgoyal/kitty/tools/cli"
"github.com/kovidgoyal/kitty/tools/cli/markup"
"github.com/kovidgoyal/kitty/tools/tui"
"github.com/kovidgoyal/kitty/tools/tui/loop"
)
var _ = fmt.Print
@@ -18,7 +19,10 @@ type Response struct {
Response string `json:"response"`
}
func show_message(msg string) {
func show_message(msg, title string) {
if title != "" {
fmt.Printf("%s", loop.EscapeCodeToSetWindowTitle(title))
}
if msg != "" {
m := markup.New(true)
fmt.Println(m.Bold(msg))
@@ -38,7 +42,7 @@ func main(_ *cli.Command, o *Options, args []string) (rc int, err error) {
return 1, err
}
case "password":
show_message(o.Message)
show_message(o.Message, o.Title)
pw, err := tui.ReadPassword(o.Prompt, false)
if err != nil {
if errors.Is(err, tui.Canceled) {
@@ -49,13 +53,13 @@ func main(_ *cli.Command, o *Options, args []string) (rc int, err error) {
}
result.Response = pw
case "line":
show_message(o.Message)
show_message(o.Message, o.Title)
result.Response, err = get_line(o, false)
if err != nil {
return 1, err
}
case "file":
show_message(o.Message)
show_message(o.Message, o.Title)
result.Response, err = get_line(o, true)
if err != nil {
return 1, err