@@ -35,7 +35,7 @@ public LauncherPage ActivePage
3535 set
3636 {
3737 if ( SetProperty ( ref _activePage , value ) )
38- PostActivePageChanged ( value ? . Data as Repository ) ;
38+ PostActivePageChanged ( ) ;
3939 }
4040 }
4141
@@ -86,10 +86,14 @@ public Launcher(string startupRepo)
8686 }
8787
8888 var activeIdx = ActiveWorkspace . ActiveIdx ;
89- if ( activeIdx >= 0 && activeIdx < Pages . Count )
89+ if ( activeIdx > 0 && activeIdx < Pages . Count )
90+ {
9091 ActivePage = Pages [ activeIdx ] ;
91- else
92- ActivePage = Pages [ 0 ] ;
92+ return ;
93+ }
94+
95+ ActivePage = Pages [ 0 ] ;
96+ PostActivePageChanged ( ) ;
9397 }
9498
9599 public void Quit ( )
@@ -222,7 +226,7 @@ public void CloseTab(LauncherPage page)
222226 last . Popup ? . Cleanup ( ) ;
223227 last . Popup = null ;
224228
225- PostActivePageChanged ( null ) ;
229+ PostActivePageChanged ( ) ;
226230 GC . Collect ( ) ;
227231 }
228232 else
@@ -338,7 +342,7 @@ public void OpenRepositoryInTab(RepositoryNode node, LauncherPage page)
338342 }
339343
340344 if ( _activePage == page )
341- PostActivePageChanged ( repo ) ;
345+ PostActivePageChanged ( ) ;
342346 else
343347 ActivePage = page ;
344348 }
@@ -433,7 +437,7 @@ private void CloseRepositoryInTab(LauncherPage page, bool removeFromWorkspace =
433437 page . Data = null ;
434438 }
435439
436- private void PostActivePageChanged ( Repository repo )
440+ private void PostActivePageChanged ( )
437441 {
438442 if ( _ignoreIndexChange )
439443 return ;
@@ -446,8 +450,10 @@ private void PostActivePageChanged(Repository repo)
446450 builder . Append ( '[' ) . Append ( _activeWorkspace . Name ) . Append ( "] " ) ;
447451 }
448452
449- if ( _activePage is { Data : Repository } )
453+ if ( _activePage is { Data : Repository repo } )
450454 {
455+ _activeWorkspace . ActiveIdx = _activeWorkspace . Repositories . IndexOf ( repo . FullPath ) ;
456+
451457 var node = _activePage . Node ;
452458 var name = node . Name ;
453459 var path = node . Id ;
@@ -469,9 +475,6 @@ private void PostActivePageChanged(Repository repo)
469475
470476 CancelCommandPalette ( ) ;
471477 Title = builder . ToString ( ) ;
472-
473- if ( repo != null )
474- _activeWorkspace . ActiveIdx = _activeWorkspace . Repositories . IndexOf ( repo . FullPath ) ;
475478 }
476479
477480 private Workspace _activeWorkspace = null ;
0 commit comments