2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -1320,12 +1320,46 @@ export class Tabs {
1320
1320
tab . reloadProject ( ) ;
1321
1321
}
1322
1322
}
1323
+
1324
+ showNextTab ( ) {
1325
+ for ( let i = 0 ; i < this . tabs . length ; i ++ ) {
1326
+ if ( this . tabs [ i ] == this . activeTab ) {
1327
+ if ( i + 1 < this . tabs . length ) {
1328
+ this . makeActive ( this . tabs [ i + 1 ] ) ;
1329
+ } else {
1330
+ this . makeActive ( this . tabs [ 0 ] ) ;
1331
+ }
1332
+ break ;
1333
+ }
1334
+ }
1335
+ }
1336
+
1337
+ showPreviousTab ( ) {
1338
+ for ( let i = 0 ; i < this . tabs . length ; i ++ ) {
1339
+ if ( this . tabs [ i ] == this . activeTab ) {
1340
+ if ( i - 1 >= 0 ) {
1341
+ this . makeActive ( this . tabs [ i - 1 ] ) ;
1342
+ } else {
1343
+ this . makeActive ( this . tabs [ this . tabs . length - 1 ] ) ;
1344
+ }
1345
+ break ;
1346
+ }
1347
+ }
1348
+ }
1323
1349
}
1324
1350
1325
1351
export let tabs : Tabs ;
1326
1352
1327
1353
export function loadTabs ( ) {
1328
1354
tabs = new Tabs ( ) ;
1355
+
1356
+ ipcRenderer . on ( "show-next-tab" , async ( ) => {
1357
+ tabs . showNextTab ( ) ;
1358
+ } ) ;
1359
+
1360
+ ipcRenderer . on ( "show-previous-tab" , async ( ) => {
1361
+ tabs . showPreviousTab ( ) ;
1362
+ } ) ;
1329
1363
}
1330
1364
1331
1365
export function openProject ( filePath : string , runMode : boolean ) {
Original file line number Diff line number Diff line change @@ -772,6 +772,30 @@ function buildViewMenu(win: IWindow | undefined) {
772
772
} ) ;
773
773
}
774
774
775
+ viewSubmenu . push ( {
776
+ label : "Next Tab" ,
777
+ accelerator : "Ctrl+Tab" ,
778
+ click : function ( item ) {
779
+ if ( win ) {
780
+ win . browserWindow . webContents . send ( "show-next-tab" ) ;
781
+ }
782
+ }
783
+ } ) ;
784
+
785
+ viewSubmenu . push ( {
786
+ label : "Previous Tab" ,
787
+ accelerator : "Ctrl+Shift+Tab" ,
788
+ click : function ( item ) {
789
+ if ( win ) {
790
+ win . browserWindow . webContents . send ( "show-previous-tab" ) ;
791
+ }
792
+ }
793
+ } ) ;
794
+
795
+ viewSubmenu . push ( {
796
+ type : "separator"
797
+ } ) ;
798
+
775
799
viewSubmenu . push ( {
776
800
label : "Reload" ,
777
801
accelerator : "CmdOrCtrl+R" ,
0 commit comments