mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
Cleanup previous PR
Also fix ask kitten not setting window title in modes other than choose
This commit is contained in:
parent
f89617893f
commit
50bc3f465e
5 changed files with 18 additions and 7 deletions
|
|
@ -267,6 +267,8 @@ Detailed list of changes
|
|||
- Make shift+left click extend the current selection instead of starting a new
|
||||
selection when the mouse is not grabbed by the TUI application (:disc:`9608`)
|
||||
|
||||
- Allow double clicking on a tab to rename it (:pull:`9609`)
|
||||
|
||||
|
||||
0.45.0 [2025-12-24]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
|||
|
|
@ -182,7 +182,8 @@ Additionally, various bits of the kitty UI itself work with the mouse. You can
|
|||
drag and drop tabs in the tab bar to re-order them or move them from one OS
|
||||
Window to another, or even pop them out into a new OS Window.
|
||||
You can drag window borders to resize windows. You can double click on empty regions
|
||||
of the tab bar to create new tabs.
|
||||
of the tab bar to create new tabs or double click on an existing tab to rename
|
||||
it.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1228,7 +1228,8 @@ class Boss:
|
|||
window: Window | None = None, # the window associated with the confirmation
|
||||
prompt: str = '> ',
|
||||
is_password: bool = False,
|
||||
initial_value: str = ''
|
||||
initial_value: str = '',
|
||||
window_title: str = '',
|
||||
) -> None:
|
||||
result: str = ''
|
||||
|
||||
|
|
@ -1242,6 +1243,8 @@ class Boss:
|
|||
cmd = ['--type', 'password' if is_password else 'line', '--message', msg, '--prompt', prompt]
|
||||
if initial_value:
|
||||
cmd.append('--default=' + initial_value)
|
||||
if window_title:
|
||||
cmd.append(f'--title={window_title}')
|
||||
self.run_kitten_with_metadata(
|
||||
'ask', cmd, window=window, custom_callback=callback_, default_data={'response': ''}, action_on_removal=on_popup_overlay_removal
|
||||
)
|
||||
|
|
@ -2340,7 +2343,7 @@ class Boss:
|
|||
prefilled = ''
|
||||
self.get_line(
|
||||
_('Enter the new title for this tab below. An empty title will cause the default title to be used.'),
|
||||
tab.set_title, window=tab.active_window, initial_value=prefilled)
|
||||
tab.set_title, window=tab.active_window, initial_value=prefilled, window_title=_('Rename tab'))
|
||||
|
||||
def create_special_window_for_show_error(self, title: str, msg: str, overlay_for: int | None = None) -> SpecialWindowInstance:
|
||||
ec = sys.exc_info()
|
||||
|
|
|
|||
|
|
@ -1734,6 +1734,7 @@ class TabManager: # {{{
|
|||
prev.tab_id == tab.id and prev2.tab_id == tab.id and
|
||||
now - prev.at <= ci and now - prev2.at <= 2 * ci
|
||||
): # double click on tab
|
||||
self.set_active_tab(tab)
|
||||
get_boss().set_tab_title()
|
||||
self.recent_mouse_events.clear()
|
||||
set_tab_being_dragged()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue