@@ -252,12 +252,12 @@ var TabGroup = Module("tabGroup", {
252
252
253
253
mappings . add ( [ modes . NORMAL ] , [ "<C-S-n>" , "<C-S-PageDown>" ] ,
254
254
"Switch to next tab group" ,
255
- function ( count ) { tabGroup . switchTo ( "+" + ( count || 1 ) , true ) ; } ,
255
+ function ( count ) { if ( tabGroup . TV ) tabGroup . switchTo ( "+" + ( count || 1 ) , true ) ; } ,
256
256
{ count : true } ) ;
257
257
258
258
mappings . add ( [ modes . NORMAL ] , [ "<C-S-p>" , "<C-S-PageUp>" ] ,
259
259
"Switch to previous tab group" ,
260
- function ( count ) { tabGroup . switchTo ( "-" + ( count || 1 ) , true ) ; } ,
260
+ function ( count ) { if ( tabGroup . TV ) tabGroup . switchTo ( "-" + ( count || 1 ) , true ) ; } ,
261
261
{ count : true } ) ;
262
262
} ,
263
263
@@ -269,21 +269,24 @@ var TabGroup = Module("tabGroup", {
269
269
* take up the current tab to the group if bang(!) specified.
270
270
*/
271
271
new Command ( [ "add" ] , "Create a new tab group" ,
272
- function ( args ) { tabGroup . createGroup ( args . literalArg , true , args . bang ? tabs . getTab ( ) : null ) ; } ,
272
+ function ( args ) { if ( tabGroup . TV ) tabGroup . createGroup ( args . literalArg , true , args . bang ? tabs . getTab ( ) : null ) ; } ,
273
273
{ bang : true , literal : 0 } ) ,
274
274
/**
275
275
* Panorama SubCommand list
276
276
* list current tab groups
277
277
*/
278
278
new Command ( [ "list" , "ls" ] , "List current tab groups" ,
279
- function ( args ) { completion . listCompleter ( "tabgroup" ) ; } ,
279
+ function ( args ) { if ( tabGroup . TV ) completion . listCompleter ( "tabgroup" ) ; } ,
280
280
{ bang : false , argCount : 0 } ) ,
281
281
/**
282
282
* Panorama SubCommad pullTab
283
283
* pull the other group's tab
284
284
*/
285
285
new Command ( [ "pull[tab]" ] , "Pull a tab from another group" ,
286
286
function ( args ) {
287
+ if ( ! tabGroup . TV )
288
+ return ;
289
+
287
290
let activeGroup = tabGroup . tabView . GroupItems . getActiveGroupItem ( ) ;
288
291
if ( ! activeGroup ) {
289
292
liberator . echoerr ( "Cannot pull tab to the current group" ) ;
@@ -314,6 +317,9 @@ var TabGroup = Module("tabGroup", {
314
317
*/
315
318
new Command ( [ "push[tab]" , "stash" ] , "Move the current tab to another group" ,
316
319
function ( args ) {
320
+ if ( ! tabGroup . TV )
321
+ return ;
322
+
317
323
let currentTab = tabs . getTab ( ) ;
318
324
if ( currentTab . pinned ) {
319
325
liberator . echoerr ( "Cannot move an App Tab" ) ;
@@ -341,7 +347,7 @@ var TabGroup = Module("tabGroup", {
341
347
* remove the current group if {group} is ommited.
342
348
*/
343
349
new Command ( [ "remove" , "rm" ] , "Close the tab group (including all tabs!)" ,
344
- function ( args ) { tabGroup . remove ( args . literalArg ) ; } ,
350
+ function ( args ) { if ( tabGroup . TV ) tabGroup . remove ( args . literalArg ) ; } ,
345
351
{
346
352
literal : 0 ,
347
353
completer : function ( context ) completion . tabgroup ( context , false ) ,
@@ -353,6 +359,9 @@ var TabGroup = Module("tabGroup", {
353
359
*/
354
360
new Command ( [ "rename" , "mv" ] , "Rename current tab group (or reset to '(Untitled)')." ,
355
361
function ( args ) {
362
+ if ( ! tabGroup . TV )
363
+ return ;
364
+
356
365
let title = args . literalArg ;
357
366
if ( ! title ) {
358
367
if ( args . bang )
@@ -370,7 +379,7 @@ var TabGroup = Module("tabGroup", {
370
379
literal : 0 ,
371
380
completer : function ( context ) {
372
381
context . title = [ "Rename current group" ] ;
373
- let activeGroup = tabGroup . tabView . GroupItems . getActiveGroupItem ( ) ;
382
+ let activeGroup = tabGroup . TV && tabGroup . tabView . GroupItems . getActiveGroupItem ( ) ;
374
383
let title = activeGroup ? activeGroup . getTitle ( ) : "" ;
375
384
context . completions = title ? [ [ title , "" ] ] : [ ] ;
376
385
}
@@ -382,6 +391,9 @@ var TabGroup = Module("tabGroup", {
382
391
*/
383
392
new Command ( [ "switch" ] , "Switch to another group" ,
384
393
function ( args ) {
394
+ if ( ! tabGroup . TV )
395
+ return ;
396
+
385
397
if ( args . count > 0 )
386
398
tabGroup . switchTo ( "+" + args . count , true ) ;
387
399
else
@@ -404,15 +416,20 @@ var TabGroup = Module("tabGroup", {
404
416
405
417
completion : function ( ) {
406
418
completion . tabgroup = function TabGroupCompleter ( context , excludeActiveGroup ) {
419
+ context . title = [ "Tab Group" ] ;
420
+ context . anchored = false ;
421
+ if ( ! tabGroup . TV ) {
422
+ context . completions = [ ] ;
423
+ return ;
424
+ }
425
+
407
426
const GI = tabGroup . tabView . GroupItems ;
408
427
let groupItems = GI . groupItems ;
409
428
if ( excludeActiveGroup ) {
410
429
let activeGroup = GI . getActiveGroupItem ( ) ;
411
430
if ( activeGroup )
412
431
groupItems = groupItems . filter ( function ( group ) group . id != activeGroup . id ) ;
413
432
}
414
- context . title = [ "Tab Group" ] ;
415
- context . anchored = false ;
416
433
context . completions = groupItems . map ( function ( group ) {
417
434
let title = group . id + ": " + ( group . getTitle ( ) || "(Untitled)" ) ;
418
435
let desc = "Tabs: " + group . getChildren ( ) . length ;
0 commit comments