From 4207c5f57986433c20a2a06007fe9992729f8edb Mon Sep 17 00:00:00 2001 From: Saibamen Date: Mon, 23 Mar 2026 12:17:43 +0100 Subject: [PATCH 1/2] feature: reopen closed tab --- src/Resources/Locales/de_DE.axaml | 2 ++ src/Resources/Locales/en_US.axaml | 2 ++ src/Resources/Locales/es_ES.axaml | 2 ++ src/Resources/Locales/fr_FR.axaml | 2 ++ src/Resources/Locales/id_ID.axaml | 2 ++ src/Resources/Locales/it_IT.axaml | 2 ++ src/Resources/Locales/ja_JP.axaml | 2 ++ src/Resources/Locales/ko_KR.axaml | 2 ++ src/Resources/Locales/pt_BR.axaml | 2 ++ src/Resources/Locales/ru_RU.axaml | 2 ++ src/Resources/Locales/ta_IN.axaml | 2 ++ src/Resources/Locales/uk_UA.axaml | 2 ++ src/Resources/Locales/zh_CN.axaml | 2 ++ src/Resources/Locales/zh_TW.axaml | 2 ++ src/ViewModels/Launcher.cs | 17 ++++++++++++++++ src/Views/Hotkeys.axaml | 33 +++++++++++++++++-------------- src/Views/Launcher.axaml.cs | 9 ++++++++- src/Views/LauncherTabBar.axaml.cs | 16 ++++++++++++++- 18 files changed, 86 insertions(+), 17 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 0fa1e680e..979f8ba50 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -487,6 +487,7 @@ $1, $2, … Werte der Eingabe-Steuerelemente GLOBAL Klone neues Repository Aktuelle Registerkarte schließen + Reopen closed tab Zur nächsten Registerkarte wechseln Zur vorherigen Registerkarte wechseln Neue Registerkarte erstellen @@ -583,6 +584,7 @@ $1, $2, … Werte der Eingabe-Steuerelemente Neue Registerkarte erstellen Lesezeichen Registerkarte schließen + Reopen Closed Tab Andere Registerkarten schließen Registerkarten zur Rechten schließen Kopiere Repository-Pfad diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index e738e223c..7f059dc18 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -491,6 +491,7 @@ GLOBAL Clone new repository Close current tab + Reopen closed tab Go to next tab Go to previous tab Create new tab @@ -591,6 +592,7 @@ Create New Tab Bookmark Close Tab + Reopen Closed Tab Close Other Tabs Close Tabs to the Right Copy Repository Path diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 2867f5f40..97501d488 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -494,6 +494,7 @@ GLOBAL Clonar repositorio nuevo Cerrar página actual + Reopen closed tab Ir a la siguiente página Ir a la página anterior Crear nueva página @@ -593,6 +594,7 @@ Crear Nueva Página Marcador Cerrar Pestaña + Reopen Closed Tab Cerrar Otras Pestañas Cerrar Pestañas a la Derecha Copiar Ruta del Repositorio diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 5a4e0b815..e5978a613 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -469,6 +469,7 @@ GLOBAL Cloner un nouveau dépôt Fermer la page en cours + Reopen closed tab Aller à la page suivante Aller à la page précédente Créer une nouvelle page @@ -544,6 +545,7 @@ Créer un nouvel onglet Bookmark Fermer l'onglet + Reopen Closed Tab Fermer les autres onglets Fermer les onglets à droite Copier le chemin vers le dépôt diff --git a/src/Resources/Locales/id_ID.axaml b/src/Resources/Locales/id_ID.axaml index 3d383f862..d9141637b 100644 --- a/src/Resources/Locales/id_ID.axaml +++ b/src/Resources/Locales/id_ID.axaml @@ -448,6 +448,7 @@ GLOBAL Clone repositori baru Tutup tab saat ini + Reopen closed tab Ke tab berikutnya Ke tab sebelumnya Buat tab baru @@ -518,6 +519,7 @@ Buat Tab Baru Bookmark Tutup Tab + Reopen Closed Tab Tutup Tab Lain Tutup Tab di Kanan Salin Jalur Repositori diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index 5ef745168..1a5e3750f 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -484,6 +484,7 @@ ${pure_files:N} Come ${files:N}, ma senza cartelle GLOBALE Clona una nuova repository Chiudi la pagina corrente + Reopen closed tab Vai alla pagina successiva Vai alla pagina precedente Crea una nuova pagina @@ -579,6 +580,7 @@ ${pure_files:N} Come ${files:N}, ma senza cartelle Crea Nuova Pagina Segnalibro Chiudi Tab + Reopen Closed Tab Chiudi Altri Tab Chiudi i Tab a Destra Copia Percorso Repository diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml index 25dd808fc..0f577144e 100644 --- a/src/Resources/Locales/ja_JP.axaml +++ b/src/Resources/Locales/ja_JP.axaml @@ -488,6 +488,7 @@ 総合 新しいリポジトリをクローン 現在のタブを閉じる + Reopen closed tab 次のタブに移動 前のタブに移動 新しいタブを作成 @@ -585,6 +586,7 @@ 新しいタブを作成 ブックマーク タブを閉じる + Reopen Closed Tab 他のタブを閉じる 右側のタブを閉じる リポジトリへのパスをコピー diff --git a/src/Resources/Locales/ko_KR.axaml b/src/Resources/Locales/ko_KR.axaml index c381f2238..a89577ccf 100644 --- a/src/Resources/Locales/ko_KR.axaml +++ b/src/Resources/Locales/ko_KR.axaml @@ -450,6 +450,7 @@ 전역 새 저장소 복제 현재 탭 닫기 + Reopen closed tab 다음 탭으로 이동 이전 탭으로 이동 새 탭 만들기 @@ -520,6 +521,7 @@ 새 탭 만들기 북마크 탭 닫기 + Reopen Closed Tab 다른 탭 닫기 오른쪽 탭 닫기 저장소 경로 복사 diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index bba18cea2..6567d40bb 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -349,6 +349,7 @@ Referência de Atalhos de Teclado GLOBAL Fechar página atual + Reopen closed tab Ir para a próxima página Ir para a página anterior Criar nova página @@ -401,6 +402,7 @@ Criar Nova Página Adicionar aos Favoritos Fechar Aba + Reopen Closed Tab Fechar Outras Abas Fechar Abas à Direita Copiar Caminho do Repositório diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index cd78046e7..3076d5032 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -495,6 +495,7 @@ ГЛОБАЛЬНЫЕ Клонировать репозиторий Закрыть текущую вкладку + Reopen closed tab Перейти на следующую вкладку Перейти на предыдущую вкладку Создать новую вкладку @@ -595,6 +596,7 @@ Создать новую вкладку Закладка Закрыть вкладку + Reopen Closed Tab Закрыть другие вкладки Закрыть вкладки справа Копировать путь репозитория diff --git a/src/Resources/Locales/ta_IN.axaml b/src/Resources/Locales/ta_IN.axaml index 94da338d3..e57e88f9d 100644 --- a/src/Resources/Locales/ta_IN.axaml +++ b/src/Resources/Locales/ta_IN.axaml @@ -337,6 +337,7 @@ உலகளாவிய புதிய களஞ்சியத்தை நகலி செய் தற்போதைய பக்கத்தை மூடு + Reopen closed tab அடுத்த பக்கத்திற்குச் செல் முந்தைய பக்கத்திற்குச் செல் புதிய பக்கத்தை உருவாக்கு @@ -398,6 +399,7 @@ புதிய பக்கத்தை உருவாக்கு புத்தகக்குறி மூடு தாவல் + Reopen Closed Tab பிற தாவல்களை மூடு வலதுபுறத்தில் உள்ள தாவல்களை மூடு களஞ்சிய பாதை நகலெடு diff --git a/src/Resources/Locales/uk_UA.axaml b/src/Resources/Locales/uk_UA.axaml index b0bcf3a48..387662ca6 100644 --- a/src/Resources/Locales/uk_UA.axaml +++ b/src/Resources/Locales/uk_UA.axaml @@ -341,6 +341,7 @@ ГЛОБАЛЬНІ Клонувати нове сховище Закрити поточну вкладку + Reopen closed tab Перейти до наступної вкладки Перейти до попередньої вкладки Створити нову вкладку @@ -402,6 +403,7 @@ Створити нову вкладку Закладка Закрити вкладку + Reopen Closed Tab Закрити інші вкладки Закрити вкладки праворуч Копіювати шлях до сховища diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 698215111..0e0f046bc 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -495,6 +495,7 @@ 全局快捷键 克隆远程仓库 关闭当前页面 + Reopen closed tab 切换到下一个页面 切换到上一个页面 新建页面 @@ -595,6 +596,7 @@ 新建空白页 设置书签 关闭标签页 + Reopen Closed Tab 关闭其他标签页 关闭右侧标签页 复制仓库路径 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 0ff1ba8ce..3456e5270 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -495,6 +495,7 @@ 全域快速鍵 複製 (clone) 遠端存放庫 關閉目前頁面 + Reopen closed tab 切換到下一個頁面 切換到上一個頁面 新增頁面 @@ -595,6 +596,7 @@ 新增分頁 設定書籤 關閉分頁 + Reopen Closed Tab 關閉其他分頁 關閉右側分頁 複製存放庫路徑 diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index ef34d4df5..be9beaa16 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Text; @@ -215,6 +216,8 @@ public void CloseTab(LauncherPage page) var last = Pages[0]; if (last.Data is Repository repo) { + _closedTabHistory.Push(last.Node); + _activeWorkspace.Repositories.Clear(); _activeWorkspace.ActiveIdx = 0; @@ -239,6 +242,11 @@ public void CloseTab(LauncherPage page) page ??= _activePage; + if (page.Data is Repository) + { + _closedTabHistory.Push(page.Node); + } + var removeIdx = Pages.IndexOf(page); var activeIdx = Pages.IndexOf(_activePage); if (removeIdx == activeIdx) @@ -249,6 +257,14 @@ public void CloseTab(LauncherPage page) GC.Collect(); } + public void ReopenLastClosedTab() + { + if (_closedTabHistory.TryPop(out var node)) + { + OpenRepositoryInTab(node, null); + } + } + public void CloseOtherTabs() { if (Pages.Count == 1) @@ -444,5 +460,6 @@ private void PostActivePageChanged() private bool _ignoreIndexChange; private string _title = string.Empty; private ICommandPalette _commandPalette; + private readonly Stack _closedTabHistory = new(); } } diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index 855e205b5..373b320b1 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -45,7 +45,7 @@ FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,0,0,8"/> - + @@ -55,26 +55,29 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + { + vm.ReopenLastClosedTab(); + ev.Handled = true; + }; + menu.Items.Add(reopen); + menu.Open(border); } From b7e0856811bb0f10755c94093fc2b2b82040e21e Mon Sep 17 00:00:00 2001 From: Saibamen Date: Mon, 23 Mar 2026 12:21:25 +0100 Subject: [PATCH 2/2] Remove trailing whitespaces --- src/Views/Hotkeys.axaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index 373b320b1..6e7e29932 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -122,16 +122,16 @@ - + - + - + - +