Only load with :edit-url if the URL was changed, remove count argument

This commit is contained in:
Jan Verbeek 2016-06-30 17:48:06 +02:00
parent eb463ab2d3
commit 6fbbc3f123

View File

@ -1930,9 +1930,7 @@ class CommandDispatcher:
nam.clear_all_ssl_errors()
@cmdutils.register(instance='command-dispatcher', scope='window')
@cmdutils.argument('count', count=True)
def edit_url(self, url=None, bg=False, tab=False, window=False,
count=None):
def edit_url(self, url=None, bg=False, tab=False, window=False):
"""Navigate to a url formed in an external editor.
The editor which should be launched can be configured via the
@ -1943,17 +1941,19 @@ class CommandDispatcher:
bg: Open in a new background tab.
tab: Open in a new tab.
window: Open in a new window.
count: The tab index to open the URL in, or None.
"""
cmdutils.check_exclusive((tab, bg, window), 'tbw')
old_url = self._current_url().toString()
ed = editor.ExternalEditor(self._win_id, self._tabbed_browser)
# Passthrough for openurl args (e.g. -t, -b, -w)
ed.editing_finished.connect(functools.partial(
self.openurl, bg=bg, tab=tab, window=window, count=count))
self._open_if_changed, old_url=old_url, bg=bg, tab=tab,
window=window))
ed.edit(url or self._current_url().toString())
ed.edit(url or old_url)
@cmdutils.register(instance='command-dispatcher', scope='window')
def set_mark(self, key):
@ -1972,3 +1972,17 @@ class CommandDispatcher:
key: mark identifier; capital indicates a global mark
"""
self._tabbed_browser.jump_mark(key)
def _open_if_changed(self, url=None, old_url=None, bg=False, tab=False,
window=False):
"""Open a URL unless it's already open in the tab.
Args:
old_url: The original URL to compare against.
url: The URL to open.
bg: Open in a new background tab.
tab: Open in a new tab.
window: Open in a new window.
"""
if bg or tab or window or url != old_url:
self.openurl(url=url, bg=bg, tab=tab, window=window)