Merge branch 'Raihid-tab-move'
This commit is contained in:
commit
362039f1ea
@ -172,6 +172,7 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Austin Anderson
|
* Austin Anderson
|
||||||
* Jimmy
|
* Jimmy
|
||||||
* Niklas Haas
|
* Niklas Haas
|
||||||
|
* Maciej Wołczyk
|
||||||
* Spreadyy
|
* Spreadyy
|
||||||
* Alexey "Averrin" Nabrodov
|
* Alexey "Averrin" Nabrodov
|
||||||
* nanjekyejoannah
|
* nanjekyejoannah
|
||||||
@ -181,7 +182,6 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* John ShaggyTwoDope Jenkins
|
* John ShaggyTwoDope Jenkins
|
||||||
* Clayton Craft
|
* Clayton Craft
|
||||||
* Peter Vilim
|
* Peter Vilim
|
||||||
* Maciej Wołczyk
|
|
||||||
* knaggita
|
* knaggita
|
||||||
* Oliver Caldwell
|
* Oliver Caldwell
|
||||||
* Julian Weigt
|
* Julian Weigt
|
||||||
|
@ -1028,21 +1028,10 @@ class CommandDispatcher:
|
|||||||
raise cmdexc.CommandError("Can't move tab to position {}!".format(
|
raise cmdexc.CommandError("Can't move tab to position {}!".format(
|
||||||
new_idx + 1))
|
new_idx + 1))
|
||||||
|
|
||||||
tab = self._current_widget()
|
|
||||||
cur_idx = self._current_index()
|
cur_idx = self._current_index()
|
||||||
icon = self._tabbed_browser.tabIcon(cur_idx)
|
|
||||||
label = self._tabbed_browser.page_title(cur_idx)
|
|
||||||
cmdutils.check_overflow(cur_idx, 'int')
|
cmdutils.check_overflow(cur_idx, 'int')
|
||||||
cmdutils.check_overflow(new_idx, 'int')
|
cmdutils.check_overflow(new_idx, 'int')
|
||||||
self._tabbed_browser.setUpdatesEnabled(False)
|
self._tabbed_browser.tabBar().moveTab(cur_idx, new_idx)
|
||||||
try:
|
|
||||||
color = self._tabbed_browser.tab_indicator_color(cur_idx)
|
|
||||||
self._tabbed_browser.removeTab(cur_idx)
|
|
||||||
self._tabbed_browser.insertTab(new_idx, tab, icon, label)
|
|
||||||
self._set_current_index(new_idx)
|
|
||||||
self._tabbed_browser.set_tab_indicator_color(new_idx, color)
|
|
||||||
finally:
|
|
||||||
self._tabbed_browser.setUpdatesEnabled(True)
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
maxsplit=0, no_replace_variables=True)
|
maxsplit=0, no_replace_variables=True)
|
||||||
|
@ -160,6 +160,7 @@ class TabCompletionModel(base.BaseCompletionModel):
|
|||||||
tab.title_changed.connect(self.rebuild)
|
tab.title_changed.connect(self.rebuild)
|
||||||
tab.shutting_down.connect(self.delayed_rebuild)
|
tab.shutting_down.connect(self.delayed_rebuild)
|
||||||
tabbed_browser.new_tab.connect(self.on_new_tab)
|
tabbed_browser.new_tab.connect(self.on_new_tab)
|
||||||
|
tabbed_browser.tabBar().tabMoved.connect(self.rebuild)
|
||||||
objreg.get("app").new_window.connect(self.on_new_window)
|
objreg.get("app").new_window.connect(self.on_new_window)
|
||||||
self.rebuild()
|
self.rebuild()
|
||||||
|
|
||||||
|
@ -102,3 +102,15 @@ Feature: Using completion
|
|||||||
And I run :completion-item-del
|
And I run :completion-item-del
|
||||||
Then the following tabs should be open:
|
Then the following tabs should be open:
|
||||||
- data/hello.txt (active)
|
- data/hello.txt (active)
|
||||||
|
|
||||||
|
Scenario: Go to tab after moving a tab
|
||||||
|
Given I have a fresh instance
|
||||||
|
When I open data/hello.txt
|
||||||
|
And I open data/hello2.txt in a new tab
|
||||||
|
# Tricking completer into not updating tabs
|
||||||
|
And I run :set-cmd-text -s :buffer
|
||||||
|
And I run :tab-move 1
|
||||||
|
And I run :buffer hello2.txt
|
||||||
|
Then the following tabs should be open:
|
||||||
|
- data/hello2.txt (active)
|
||||||
|
- data/hello.txt
|
||||||
|
@ -27,7 +27,7 @@ from unittest import mock
|
|||||||
from PyQt5.QtCore import pyqtSignal, QPoint, QProcess, QObject
|
from PyQt5.QtCore import pyqtSignal, QPoint, QProcess, QObject
|
||||||
from PyQt5.QtNetwork import (QNetworkRequest, QAbstractNetworkCache,
|
from PyQt5.QtNetwork import (QNetworkRequest, QAbstractNetworkCache,
|
||||||
QNetworkCacheMetaData)
|
QNetworkCacheMetaData)
|
||||||
from PyQt5.QtWidgets import QCommonStyle, QLineEdit, QWidget
|
from PyQt5.QtWidgets import QCommonStyle, QLineEdit, QWidget, QTabBar
|
||||||
|
|
||||||
from qutebrowser.browser import browsertab, history
|
from qutebrowser.browser import browsertab, history
|
||||||
from qutebrowser.config import configexc
|
from qutebrowser.config import configexc
|
||||||
@ -571,6 +571,7 @@ class TabbedBrowserStub(QObject):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.tabs = []
|
self.tabs = []
|
||||||
self.shutting_down = False
|
self.shutting_down = False
|
||||||
|
self._qtabbar = QTabBar()
|
||||||
|
|
||||||
def count(self):
|
def count(self):
|
||||||
return len(self.tabs)
|
return len(self.tabs)
|
||||||
@ -584,6 +585,9 @@ class TabbedBrowserStub(QObject):
|
|||||||
def on_tab_close_requested(self, idx):
|
def on_tab_close_requested(self, idx):
|
||||||
del self.tabs[idx]
|
del self.tabs[idx]
|
||||||
|
|
||||||
|
def tabBar(self):
|
||||||
|
return self._qtabbar
|
||||||
|
|
||||||
|
|
||||||
class ApplicationStub(QObject):
|
class ApplicationStub(QObject):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user