« get me outta code hell

New empty tab - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-07-06 12:21:14 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-06 12:21:14 -0300
commit24e8ed61d6111d1d6c4a27e133fce9edd5f767cb (patch)
treefeffabaee7f00bbb50216d9203f5a534c0052b09
parent6d9bcdb9b50f69787593caff3f27eb04e15fe8aa (diff)
New empty tab
-rw-r--r--ui.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index a18cd4d..89801d7 100644
--- a/ui.js
+++ b/ui.js
@@ -334,6 +334,8 @@ class AppElement extends FocusElement {
       this.form.updateSelectedElement()
     } else if (keyBuf.equals(Buffer.from([5]))) { // Ctrl-E
       this.editMode = !this.editMode
+    } else if (this.editMode && keyBuf.equals(Buffer.from([14]))) { // ctrl-N
+      this.newEmptyTab()
     } else if (keyBuf.equals(Buffer.from([15]))) { // ctrl-O
       this.openPlaylistDialog.open()
     } else if (keyBuf.equals(Buffer.from([20]))) { // ctrl-T
@@ -353,6 +355,14 @@ class AppElement extends FocusElement {
     }
   }
 
+  newEmptyTab() {
+    const listing = this.newGrouplikeListing()
+    listing.loadGrouplike({
+      name: 'New Playlist',
+      items: []
+    })
+  }
+
   cloneCurrentTab() {
     const grouplike = this.tabber.currentElement.grouplike
     const listing = this.newGrouplikeListing()