Repository: qutebrowser/qutebrowser
Pull request: PR makes :open command in pinned-tab open in new tab.
<!-- Thanks for submitting a pull request! Please pick a descriptive title (not just "issue 12345"). If there is an open issue associated to your PR, please add a line like "Closes #12345" somewhere in the PR description (outside of this comment) -->
This PR modifies the existing :open command so that in a pinned tab it shows a warning '_**Tab is pinned!Opening in new tab**_'.And then opens in a new tab like expected.
Closes #6184 .

Problem statement:
open in new tab by default if current tab is pinned.
If the current tab is pinned, then using ':open' gives a message 'tab is pinned'
It would be useful to have an option to make 'open' default to opening new tab when the current tab is pinned, rather than throwing an error.

Hints from issue discussion:
I guess that makes sense. I'm not even sure if it needs to be an option, I'd be fine with making it the default.
Can I try to work on it if anybody else is not.I was thinking I could start contributing from this issue.

@pspiagicw Please go ahead! The relevant code is in `openurl` in `qutebrowser/browser/commands.py`.

Commit message: Added the session test as well

Patch to review:
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py
index dc0664238bf..4e8ad8d578e 100644
--- a/qutebrowser/browser/commands.py
+++ b/qutebrowser/browser/commands.py
@@ -329,7 +329,9 @@ def openurl(self, url=None, related=False,
                         # Explicit count with a tab that doesn't exist.
                         return
                 elif curtab.navigation_blocked():
-                    message.info("Tab is pinned!")
+                    message.info("Tab is pinned! Opening in new tab")
+                    self._tabbed_browser.tabopen(cur_url)
+
                 else:
                     curtab.load_url(cur_url)
 
diff --git a/tests/end2end/features/sessions.feature b/tests/end2end/features/sessions.feature
index 0f0c015e0c6..cdf21439675 100644
--- a/tests/end2end/features/sessions.feature
+++ b/tests/end2end/features/sessions.feature
@@ -395,9 +395,10 @@ Feature: Saving and loading sessions
       And I run :session-load -c pin_session
       And I wait until data/numbers/3.txt is loaded
       And I run :tab-focus 2
-      And I run :open hello world
-      Then the message "Tab is pinned!" should be shown
+      And I run :open data/numbers/4.txt
+      Then the message "Tab is pinned! Opening in new tab" should be shown
       And the following tabs should be open:
         - data/numbers/1.txt
         - data/numbers/2.txt (active) (pinned)
+        - data/numbers/4.txt
         - data/numbers/3.txt
diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature
index ca0efefc471..2a641bebaff 100644
--- a/tests/end2end/features/tabs.feature
+++ b/tests/end2end/features/tabs.feature
@@ -1535,9 +1535,10 @@ Feature: Tab management
         When I open data/numbers/1.txt
         And I run :tab-pin
         And I open data/numbers/2.txt without waiting
-        Then the message "Tab is pinned!" should be shown
+        Then the message "Tab is pinned! Opening in new tab" should be shown
         And the following tabs should be open:
             - data/numbers/1.txt (active) (pinned)
+            - data/numbers/2.txt
 
     Scenario: :tab-pin open url with tabs.pinned.frozen = false
         When I set tabs.pinned.frozen to false


Code review comments:
diff_hunk: @@ -1535,9 +1535,10 @@ Feature: Tab management
         When I open data/numbers/1.txt
         And I run :tab-pin
         And I open data/numbers/2.txt without waiting
path: tests/end2end/features/tabs.feature
text: @user1:
```suggestion
        And I open data/numbers/2.txt
```

so that the test now actually waits for the new tab to be opened.

@author:
Okay will do in next commit.