mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Cleanup previous PR
Also fix ask kitten not setting window title in modes other than choose
This commit is contained in:
@@ -267,6 +267,8 @@ Detailed list of changes
|
|||||||
- Make shift+left click extend the current selection instead of starting a new
|
- 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`)
|
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]
|
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
|
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.
|
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
|
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::
|
.. toctree::
|
||||||
:hidden:
|
:hidden:
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/kovidgoyal/kitty/tools/cli"
|
"github.com/kovidgoyal/kitty/tools/cli"
|
||||||
"github.com/kovidgoyal/kitty/tools/cli/markup"
|
"github.com/kovidgoyal/kitty/tools/cli/markup"
|
||||||
"github.com/kovidgoyal/kitty/tools/tui"
|
"github.com/kovidgoyal/kitty/tools/tui"
|
||||||
|
"github.com/kovidgoyal/kitty/tools/tui/loop"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = fmt.Print
|
var _ = fmt.Print
|
||||||
@@ -18,7 +19,10 @@ type Response struct {
|
|||||||
Response string `json:"response"`
|
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 != "" {
|
if msg != "" {
|
||||||
m := markup.New(true)
|
m := markup.New(true)
|
||||||
fmt.Println(m.Bold(msg))
|
fmt.Println(m.Bold(msg))
|
||||||
@@ -38,7 +42,7 @@ func main(_ *cli.Command, o *Options, args []string) (rc int, err error) {
|
|||||||
return 1, err
|
return 1, err
|
||||||
}
|
}
|
||||||
case "password":
|
case "password":
|
||||||
show_message(o.Message)
|
show_message(o.Message, o.Title)
|
||||||
pw, err := tui.ReadPassword(o.Prompt, false)
|
pw, err := tui.ReadPassword(o.Prompt, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, tui.Canceled) {
|
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
|
result.Response = pw
|
||||||
case "line":
|
case "line":
|
||||||
show_message(o.Message)
|
show_message(o.Message, o.Title)
|
||||||
result.Response, err = get_line(o, false)
|
result.Response, err = get_line(o, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 1, err
|
return 1, err
|
||||||
}
|
}
|
||||||
case "file":
|
case "file":
|
||||||
show_message(o.Message)
|
show_message(o.Message, o.Title)
|
||||||
result.Response, err = get_line(o, true)
|
result.Response, err = get_line(o, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 1, err
|
return 1, err
|
||||||
|
|||||||
@@ -1228,7 +1228,8 @@ class Boss:
|
|||||||
window: Window | None = None, # the window associated with the confirmation
|
window: Window | None = None, # the window associated with the confirmation
|
||||||
prompt: str = '> ',
|
prompt: str = '> ',
|
||||||
is_password: bool = False,
|
is_password: bool = False,
|
||||||
initial_value: str = ''
|
initial_value: str = '',
|
||||||
|
window_title: str = '',
|
||||||
) -> None:
|
) -> None:
|
||||||
result: str = ''
|
result: str = ''
|
||||||
|
|
||||||
@@ -1242,6 +1243,8 @@ class Boss:
|
|||||||
cmd = ['--type', 'password' if is_password else 'line', '--message', msg, '--prompt', prompt]
|
cmd = ['--type', 'password' if is_password else 'line', '--message', msg, '--prompt', prompt]
|
||||||
if initial_value:
|
if initial_value:
|
||||||
cmd.append('--default=' + initial_value)
|
cmd.append('--default=' + initial_value)
|
||||||
|
if window_title:
|
||||||
|
cmd.append(f'--title={window_title}')
|
||||||
self.run_kitten_with_metadata(
|
self.run_kitten_with_metadata(
|
||||||
'ask', cmd, window=window, custom_callback=callback_, default_data={'response': ''}, action_on_removal=on_popup_overlay_removal
|
'ask', cmd, window=window, custom_callback=callback_, default_data={'response': ''}, action_on_removal=on_popup_overlay_removal
|
||||||
)
|
)
|
||||||
@@ -2340,7 +2343,7 @@ class Boss:
|
|||||||
prefilled = ''
|
prefilled = ''
|
||||||
self.get_line(
|
self.get_line(
|
||||||
_('Enter the new title for this tab below. An empty title will cause the default title to be used.'),
|
_('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:
|
def create_special_window_for_show_error(self, title: str, msg: str, overlay_for: int | None = None) -> SpecialWindowInstance:
|
||||||
ec = sys.exc_info()
|
ec = sys.exc_info()
|
||||||
|
|||||||
@@ -1734,6 +1734,7 @@ class TabManager: # {{{
|
|||||||
prev.tab_id == tab.id and prev2.tab_id == tab.id and
|
prev.tab_id == tab.id and prev2.tab_id == tab.id and
|
||||||
now - prev.at <= ci and now - prev2.at <= 2 * ci
|
now - prev.at <= ci and now - prev2.at <= 2 * ci
|
||||||
): # double click on tab
|
): # double click on tab
|
||||||
|
self.set_active_tab(tab)
|
||||||
get_boss().set_tab_title()
|
get_boss().set_tab_title()
|
||||||
self.recent_mouse_events.clear()
|
self.recent_mouse_events.clear()
|
||||||
set_tab_being_dragged()
|
set_tab_being_dragged()
|
||||||
|
|||||||
Reference in New Issue
Block a user