mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 05:35:19 +02:00
Set window title when showing errors
This commit is contained in:
@@ -42,6 +42,7 @@ func main(args []string, opts *Options) (rc int, err error) {
|
||||
f := markup.New(true)
|
||||
if opts.Title != "" {
|
||||
fmt.Println(f.Err(opts.Title))
|
||||
fmt.Println(loop.EscapeCodeToSetWindowTitle(opts.Title))
|
||||
fmt.Println()
|
||||
}
|
||||
fmt.Println(m.Msg)
|
||||
|
||||
@@ -404,10 +404,13 @@ func (self *Loop) AllowLineWrapping(allow bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func EscapeCodeToSetWindowTitle(title string) string {
|
||||
title = wcswidth.StripEscapeCodes(title)
|
||||
return "\033]2;" + title + "\033\\"
|
||||
}
|
||||
|
||||
func (self *Loop) SetWindowTitle(title string) {
|
||||
title = strings.ReplaceAll(title, "\033", "")
|
||||
title = strings.ReplaceAll(title, "\x9c", "")
|
||||
self.QueueWriteString("\033]2;" + title + "\033\\")
|
||||
self.QueueWriteString(EscapeCodeToSetWindowTitle(title))
|
||||
}
|
||||
|
||||
func (self *Loop) ClearScreen() {
|
||||
|
||||
Reference in New Issue
Block a user