Cleanup copilot code

This commit is contained in:
Kovid Goyal
2026-03-17 13:39:07 +05:30
parent e98f80d836
commit f2734fcfbd
2 changed files with 12 additions and 11 deletions

View File

@@ -176,6 +176,8 @@ Detailed list of changes
- Fix incorrect behavior when using the actions to move tab forward/backward - Fix incorrect behavior when using the actions to move tab forward/backward
with a tab_bar_filter active (:iss:`9672`) with a tab_bar_filter active (:iss:`9672`)
- Prevent stacking of multiple rename tab windows (:iss:`9691`)
0.46.1 [2026-03-16] 0.46.1 [2026-03-16]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1252,9 +1252,10 @@ class Boss:
cmd.append('--default=' + initial_value) cmd.append('--default=' + initial_value)
if window_title: if window_title:
cmd.append(f'--title={window_title}') cmd.append(f'--title={window_title}')
return self.run_kitten_with_metadata( w = 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
) )
return w if isinstance(w, Window) else None
def get_save_filepath( def get_save_filepath(
self, msg: str, # can contain newlines and ANSI formatting self, msg: str, # can contain newlines and ANSI formatting
@@ -2377,18 +2378,16 @@ class Boss:
title = '' title = ''
tab.set_title(title) tab.set_title(title)
return return
if tab.renaming_in_window and tab.renaming_in_window in self.window_id_map: if (w := self.window_id_map.get(tab.renaming_in_window)) is not None and w in tab:
w = self.window_id_map[tab.renaming_in_window] tab.set_active_window(w)
if w in tab: return
tab.set_active_window(w) prefilled = (tab.name or tab.title).strip()
return tab_id = tab.id
prefilled = tab.name or tab.title
if title in ('" "', "' '"):
prefilled = ''
def on_rename_done(new_title: str) -> None: def on_rename_done(new_title: str) -> None:
tab.renaming_in_window = 0 if (tab := self.tab_for_id(tab_id)) is not None:
tab.set_title(new_title) tab.renaming_in_window = 0
tab.set_title(new_title)
overlay_window = self.get_line( overlay_window = 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.'),