From 7cf868ef0168ae806d86b6d0896a3ac82966266b Mon Sep 17 00:00:00 2001
From: Robert Cranston <rcrnstn@rcrnstn.net>
Date: Mon, 20 May 2019 00:20:37 +0200
Subject: [PATCH] In bmark, add default title when using default url

---
 src/excmds.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/excmds.ts b/src/excmds.ts
index 6e419d9..8b39f75 100644
--- a/src/excmds.ts
+++ b/src/excmds.ts
@@ -4031,7 +4031,12 @@ export async function perfhistogram(...filters: string[]) {
  */
 //#background
 export async function bmark(url?: string, ...titlearr: string[]) {
-    url = url === undefined ? (await activeTab()).url : url
+    if (url === undefined) {
+        url = (await activeTab()).url
+        if (!titlearr.length) {
+            titlearr = [(await activeTab()).title]
+        }
+    }
     let title = titlearr.join(" ")
     // if titlearr is given and we have duplicates, we probably want to give an error here.
     const dupbmarks = await browser.bookmarks.search({ url })
-- 
2.17.1