From c8ae405bfe7dd3a0b583013ed1b894c71186e4c7 Mon Sep 17 00:00:00 2001 From: seebye Date: Wed, 20 Dec 2017 00:10:21 +0100 Subject: [PATCH 01/16] fix #3396 --- qutebrowser/browser/history.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/history.py index ecab730ae..e82e6970d 100644 --- a/qutebrowser/browser/history.py +++ b/qutebrowser/browser/history.py @@ -171,7 +171,9 @@ class WebHistory(sql.SqlTable): @pyqtSlot(QUrl, QUrl, str) def add_from_tab(self, url, requested_url, title): """Add a new history entry as slot, called from a BrowserTab.""" - if url.scheme() == 'data' or requested_url.scheme() == 'data': + if any(url.scheme() == 'data' or + ('qute', 'back') == (url.scheme(), url.host()) + for url in (url, requested_url)): return if url.isEmpty(): # things set via setHtml From 801b6b90ce43b78d0a202f018833621b486cc7f7 Mon Sep 17 00:00:00 2001 From: seebye Date: Wed, 20 Dec 2017 01:15:12 +0100 Subject: [PATCH 02/16] pylint adjustments --- qutebrowser/browser/history.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/history.py index e82e6970d..e800ac0b2 100644 --- a/qutebrowser/browser/history.py +++ b/qutebrowser/browser/history.py @@ -173,7 +173,7 @@ class WebHistory(sql.SqlTable): """Add a new history entry as slot, called from a BrowserTab.""" if any(url.scheme() == 'data' or ('qute', 'back') == (url.scheme(), url.host()) - for url in (url, requested_url)): + for url in (url, requested_url)): return if url.isEmpty(): # things set via setHtml From 125af531cb8519916a29ff79733dd4fb5a660826 Mon Sep 17 00:00:00 2001 From: seebye Date: Fri, 22 Dec 2017 15:44:42 +0100 Subject: [PATCH 03/16] database qute://back --- qutebrowser/browser/history.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/history.py index e800ac0b2..04bc1be15 100644 --- a/qutebrowser/browser/history.py +++ b/qutebrowser/browser/history.py @@ -32,7 +32,7 @@ from qutebrowser.misc import objects, sql # increment to indicate that HistoryCompletion must be regenerated -_USER_VERSION = 1 +_USER_VERSION = 2 class CompletionHistory(sql.SqlTable): @@ -102,7 +102,8 @@ class WebHistory(sql.SqlTable): data = {'url': [], 'title': [], 'last_atime': []} # select the latest entry for each url q = sql.Query('SELECT url, title, max(atime) AS atime FROM History ' - 'WHERE NOT redirect GROUP BY url ORDER BY atime asc') + 'WHERE NOT redirect and url NOT LIKE "qute://back%" ' + 'GROUP BY url ORDER BY atime asc') for entry in q.run(): data['url'].append(self._format_completion_url(QUrl(entry.url))) data['title'].append(entry.title) @@ -172,7 +173,7 @@ class WebHistory(sql.SqlTable): def add_from_tab(self, url, requested_url, title): """Add a new history entry as slot, called from a BrowserTab.""" if any(url.scheme() == 'data' or - ('qute', 'back') == (url.scheme(), url.host()) + (url.scheme(), url.host()) == ('qute', 'back') for url in (url, requested_url)): return if url.isEmpty(): From d9b00acdc665e88d41d96bdba199f5f69c2302d8 Mon Sep 17 00:00:00 2001 From: RyanJenkins Date: Sat, 23 Dec 2017 23:59:02 -0800 Subject: [PATCH 04/16] Return focus to qutebrowser when external editor finishes. --- qutebrowser/browser/commands.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 92a841d72..a912842f6 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1639,6 +1639,7 @@ class CommandDispatcher: """ try: elem.set_value(text) + mainwindow.raise_window(objreg.last_focused_window()) except webelem.OrphanedError as e: message.error('Edited element vanished') except webelem.Error as e: From 9cb25e0c76e80b311898fd5aace7c27ac2169bdc Mon Sep 17 00:00:00 2001 From: RyanJenkins Date: Tue, 26 Dec 2017 20:19:39 -0800 Subject: [PATCH 05/16] Raise browser window after editor closes regardless of outcome of inserting text and avoid calling QApplication.instance().alert() in this scenario. --- qutebrowser/browser/commands.py | 3 ++- qutebrowser/mainwindow/mainwindow.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index a912842f6..3fffbcfb7 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1639,12 +1639,13 @@ class CommandDispatcher: """ try: elem.set_value(text) - mainwindow.raise_window(objreg.last_focused_window()) except webelem.OrphanedError as e: message.error('Edited element vanished') except webelem.Error as e: raise cmdexc.CommandError(str(e)) + mainwindow.raise_window(objreg.last_focused_window(), alert=False) + @cmdutils.register(instance='command-dispatcher', maxsplit=0, scope='window') def insert_text(self, text): diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 3adce7567..9d288b565 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -94,13 +94,15 @@ def get_window(via_ipc, force_window=False, force_tab=False, return window.win_id -def raise_window(window): +def raise_window(window, alert=False): """Raise the given MainWindow object.""" window.setWindowState(window.windowState() & ~Qt.WindowMinimized) window.setWindowState(window.windowState() | Qt.WindowActive) window.raise_() window.activateWindow() - QApplication.instance().alert(window) + + if alert: + QApplication.instance().alert(window) # WORKAROUND for https://github.com/PyCQA/pylint/issues/1770 From 53575aaeed5a1e8389bbf0980fed757e85c34349 Mon Sep 17 00:00:00 2001 From: RyanJenkins Date: Wed, 27 Dec 2017 12:40:55 -0800 Subject: [PATCH 06/16] Default raise_windows() alert param to True to preserve existing behavior --- qutebrowser/mainwindow/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 9d288b565..dff465c41 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -94,7 +94,7 @@ def get_window(via_ipc, force_window=False, force_tab=False, return window.win_id -def raise_window(window, alert=False): +def raise_window(window, alert=True): """Raise the given MainWindow object.""" window.setWindowState(window.windowState() & ~Qt.WindowMinimized) window.setWindowState(window.windowState() | Qt.WindowActive) From c290b3f80f41b255a5b46480990d692425a6c253 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Thu, 4 Jan 2018 12:27:19 -0500 Subject: [PATCH 07/16] Don't attempt completion if input starts with flag. Always interpret the first word in the command string as the command to offer completions for, even if that word looks like a flag. Fixes #3460, where the command string `:-w open` would attempt to offer completions for `open` but crash because the parsing was thrown off. By moving the flag-stripping logic to _after_ we determine the command, `:-w open` interprets `:-w` as the command. Since that is not a valid command, we won't offer any completions. --- qutebrowser/completion/completer.py | 5 +++-- tests/unit/completion/test_completer.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index 30a180554..4e187750d 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -87,8 +87,6 @@ class Completer(QObject): # cursor on a flag or after an explicit split (--) return None log.completion.debug("Before removing flags: {}".format(before_cursor)) - before_cursor = [x for x in before_cursor if not x.startswith('-')] - log.completion.debug("After removing flags: {}".format(before_cursor)) if not before_cursor: # '|' or 'set|' log.completion.debug('Starting command completion') @@ -99,6 +97,9 @@ class Completer(QObject): log.completion.debug("No completion for unknown command: {}" .format(before_cursor[0])) return None + + before_cursor = [x for x in before_cursor if not x.startswith('-')] + log.completion.debug("After removing flags: {}".format(before_cursor)) argpos = len(before_cursor) - 1 try: func = cmd.get_pos_arg_info(argpos).completion diff --git a/tests/unit/completion/test_completer.py b/tests/unit/completion/test_completer.py index e25d4e5d1..4b39b7032 100644 --- a/tests/unit/completion/test_completer.py +++ b/tests/unit/completion/test_completer.py @@ -190,6 +190,7 @@ def _set_cmd_prompt(cmd, txt): (':gibberish nonesense |', None, '', []), ('/:help|', None, '', []), ('::bind|', 'command', ':bind', []), + (':-w open |', None, '', []), ]) def test_update_completion(txt, kind, pattern, pos_args, status_command_stub, completer_obj, completion_widget_stub, config_stub, From 0101596148ad823e0be4c576187fa4e2a37dcf4b Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 8 Jan 2018 16:39:12 +0100 Subject: [PATCH 08/16] Update codecov from 2.0.10 to 2.0.13 --- misc/requirements/requirements-codecov.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-codecov.txt b/misc/requirements/requirements-codecov.txt index 6601cfb12..df7a12ed6 100644 --- a/misc/requirements/requirements-codecov.txt +++ b/misc/requirements/requirements-codecov.txt @@ -2,7 +2,7 @@ certifi==2017.11.5 chardet==3.0.4 -codecov==2.0.10 +codecov==2.0.13 coverage==4.4.2 idna==2.6 requests==2.18.4 From 6c91633293832ba7bf1364924782011e7d133146 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 8 Jan 2018 16:39:14 +0100 Subject: [PATCH 09/16] Update flake8-docstrings from 1.1.0 to 1.3.0 --- misc/requirements/requirements-flake8.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index f73294005..6acc0c022 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -8,7 +8,7 @@ flake8-comprehensions==1.4.1 flake8-copyright==0.2.0 flake8-debugger==3.0.0 flake8-deprecated==1.3 -flake8-docstrings==1.1.0 +flake8-docstrings==1.3.0 flake8-future-import==0.4.3 flake8-mock==0.3 flake8-per-file-ignores==0.4 From f836b615c1fc7e4333793dc8459420788b62ecdf Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 8 Jan 2018 16:39:15 +0100 Subject: [PATCH 10/16] Update flake8-future-import from 0.4.3 to 0.4.4 --- misc/requirements/requirements-flake8.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index 6acc0c022..0448bee52 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -9,7 +9,7 @@ flake8-copyright==0.2.0 flake8-debugger==3.0.0 flake8-deprecated==1.3 flake8-docstrings==1.3.0 -flake8-future-import==0.4.3 +flake8-future-import==0.4.4 flake8-mock==0.3 flake8-per-file-ignores==0.4 flake8-polyfill==1.0.2 From 8459c662e7cc992780f8c3af92b8d4809131d226 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 8 Jan 2018 16:39:17 +0100 Subject: [PATCH 11/16] Update pep8-naming from 0.4.1 to 0.5.0 --- misc/requirements/requirements-flake8.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index 0448bee52..0ae43d663 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -17,7 +17,7 @@ flake8-string-format==0.2.3 flake8-tidy-imports==1.1.0 flake8-tuple==0.2.13 mccabe==0.6.1 -pep8-naming==0.4.1 +pep8-naming==0.5.0 pycodestyle==2.3.1 pydocstyle==2.1.1 pyflakes==1.6.0 From 6a3b5a9d4e8bb25bdd340ca095cbba9571e70b51 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 8 Jan 2018 16:39:18 +0100 Subject: [PATCH 12/16] Update setuptools from 38.2.5 to 38.4.0 --- misc/requirements/requirements-pip.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-pip.txt b/misc/requirements/requirements-pip.txt index 42fae6bc9..54cacc3c3 100644 --- a/misc/requirements/requirements-pip.txt +++ b/misc/requirements/requirements-pip.txt @@ -3,6 +3,6 @@ appdirs==1.4.3 packaging==16.8 pyparsing==2.2.0 -setuptools==38.2.5 +setuptools==38.4.0 six==1.11.0 wheel==0.30.0 From 70ad02b79b55983db691748a75b6403b4eba3532 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 8 Jan 2018 16:39:20 +0100 Subject: [PATCH 13/16] Update hypothesis from 3.44.4 to 3.44.13 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 42a5f2b7d..211506ae5 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -11,7 +11,7 @@ fields==5.0.0 Flask==0.12.2 glob2==0.6 hunter==2.0.2 -hypothesis==3.44.4 +hypothesis==3.44.13 itsdangerous==0.24 # Jinja2==2.10 Mako==1.0.7 From 7b348fe17c7297826dd71fe637fa1d29b9ee25be Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 8 Jan 2018 16:39:21 +0100 Subject: [PATCH 14/16] Update pytest-qt from 2.3.0 to 2.3.1 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 211506ae5..e5f9d35af 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -28,7 +28,7 @@ pytest-cov==2.5.1 pytest-faulthandler==1.3.1 pytest-instafail==0.3.0 pytest-mock==1.6.3 -pytest-qt==2.3.0 +pytest-qt==2.3.1 pytest-repeat==0.4.1 pytest-rerunfailures==4.0 pytest-travis-fold==1.3.0 From c1855e1741298f4a27d89ba71e243c403233a6da Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 10 Jan 2018 09:34:00 +0100 Subject: [PATCH 15/16] Update changelog --- doc/changelog.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 4e51f1c5b..47bf1e8e8 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -134,6 +134,7 @@ Fixed - Fix crash when a subprocess outputs data which is not decodable as UTF-8. - Fix crash when closing a tab immediately after hinting. - Worked around issues in Qt 5.10 with loading progress never being finished. +- Fixed a crash when writing a flag before a command (e.g. `:-w open `). Deprecated ~~~~~~~~~~ From 1f8d6e21682a4c18c305aa28f3c6a1135b44aade Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 10 Jan 2018 09:39:46 +0100 Subject: [PATCH 16/16] Update changelog --- doc/changelog.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 47bf1e8e8..8c3a533a2 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -110,6 +110,7 @@ Changed order, and mixed matches on URL/tite are possible. - The system's default encoding (rather than UTF-8) is now used to decode subprocess output. +- qutebrowser now ensures it's focused again after an external editor is closed. Fixed ~~~~~