From 73f999da31286f3b6bcd04e8a07af2b2d4443736 Mon Sep 17 00:00:00 2001 From: Artur Shaik Date: Sat, 28 Nov 2015 21:29:54 +0600 Subject: [PATCH 1/6] Revert a43c206 and b344f92. --- pytest.ini | 2 -- tests/integration/features/caret.feature | 17 ----------------- tests/integration/features/conftest.py | 24 ------------------------ 3 files changed, 43 deletions(-) diff --git a/pytest.ini b/pytest.ini index 3dcf09232..81826c4e7 100644 --- a/pytest.ini +++ b/pytest.ini @@ -11,8 +11,6 @@ markers = not_xvfb: Tests which can't be run with Xvfb. frozen: Tests which can only be run if sys.frozen is True. integration: Tests which test a bigger portion of code, run without coverage. - xfail_issue1142_osx: https://github.com/The-Compiler/qutebrowser/issues/1142 (OS X) - xfail_issue1142_windows: https://github.com/The-Compiler/qutebrowser/issues/1142 (Windows) flakes-ignore = UnusedImport UnusedVariable diff --git a/tests/integration/features/caret.feature b/tests/integration/features/caret.feature index 72c82ce23..b6b3fab32 100644 --- a/tests/integration/features/caret.feature +++ b/tests/integration/features/caret.feature @@ -18,7 +18,6 @@ Feature: Caret mode four five six vier fünf sechs - @xfail_issue1142_windows Scenario: Moving to end and to start of document When I run :move-to-end-of-document And I run :move-to-start-of-document @@ -49,7 +48,6 @@ Feature: Caret mode one two three eins zwei drei - @xfail_issue1142_osx Scenario: Moving back to the end of previous block (with selection) When I run :move-to-end-of-next-block with count 2 And I run :toggle-selection @@ -61,7 +59,6 @@ Feature: Caret mode four five six - @xfail_issue1142_windows Scenario: Moving back to the end of previous block When I run :move-to-end-of-next-block with count 2 And I run :move-to-end-of-prev-block @@ -80,7 +77,6 @@ Feature: Caret mode four five six - @xfail_issue1142_windows Scenario: Moving back to the start of previous block When I run :move-to-end-of-next-block with count 2 And I run :move-to-start-of-prev-block @@ -89,14 +85,12 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain "eins " - @xfail_issue1142_osx Scenario: Moving to the start of next block (with selection) When I run :toggle-selection And I run :move-to-start-of-next-block And I yank the selected text Then the clipboard should contain "one two three\n" - @xfail_issue1142_windows Scenario: Moving to the start of next block When I run :move-to-start-of-next-block And I run :toggle-selection @@ -125,7 +119,6 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain "one two three\n" - @xfail_issue1142_windows Scenario: Moving to end and to start of line When I run :move-to-end-of-line And I run :move-to-start-of-line @@ -158,14 +151,12 @@ Feature: Caret mode # word - @xfail_issue1142_windows Scenario: Selecting a word When I run :toggle-selection And I run :move-to-end-of-word And I yank the selected text Then the clipboard should contain "one" - @xfail_issue1142_windows Scenario: Moving to end and selecting a word When I run :move-to-end-of-word And I run :toggle-selection @@ -173,7 +164,6 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain " two" - @xfail_issue1142_windows Scenario: Moving to next word and selecting a word When I run :move-to-next-word And I run :toggle-selection @@ -181,7 +171,6 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain "two" - @xfail_issue1142_windows Scenario: Moving to next word and selecting until next word When I run :move-to-next-word And I run :toggle-selection @@ -189,7 +178,6 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain "two " - @xfail_issue1142_windows Scenario: Moving to previous word and selecting a word When I run :move-to-end-of-word And I run :toggle-selection @@ -197,7 +185,6 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain "one" - @xfail_issue1142_windows Scenario: Moving to previous word When I run :move-to-end-of-word And I run :move-to-prev-word @@ -221,7 +208,6 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain "n" - @xfail_issue1142_windows Scenario: Selecting previous char When I run :move-to-end-of-word And I run :toggle-selection @@ -229,7 +215,6 @@ Feature: Caret mode And I yank the selected text Then the clipboard should contain "e" - @xfail_issue1142_windows Scenario: Moving to previous char When I run :move-to-end-of-word And I run :move-to-prev-char @@ -244,7 +229,6 @@ Feature: Caret mode When I run :yank-selected Then the message "Nothing to yank" should be shown. - @xfail_issue1142_windows Scenario: :yank-selected message When I run :toggle-selection And I run :move-to-end-of-word @@ -265,7 +249,6 @@ Feature: Caret mode Then the message "3 chars yanked to primary selection" should be shown. And the primary selection should contain "one" - @xfail_issue1142_windows Scenario: :yank-selected with --keep When I run :toggle-selection And I run :move-to-end-of-word diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 3e9b6f0ba..b8131e46b 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -19,9 +19,7 @@ """Steps for bdd-like tests.""" -import os import re -import sys import time import json import os.path @@ -47,28 +45,6 @@ def _clipboard_mode(qapp, what): raise AssertionError -def pytest_collection_modifyitems(items): - """Handle markers for xfail caret tests on OS X/Windows. - - See https://github.com/The-Compiler/qutebrowser/issues/1142 - - We need to do this this way because we can't use markers with arguments - inside feature files. - """ - osx_xfail_marker = pytest.mark.xfail( - sys.platform == 'darwin', - reason='https://github.com/The-Compiler/qutebrowser/issues/1142') - windows_xfail_marker = pytest.mark.xfail( - os.name == 'nt', - reason='https://github.com/The-Compiler/qutebrowser/issues/1142') - - for item in items: - if item.get_marker('xfail_issue1142_osx'): - item.add_marker(osx_xfail_marker) - if item.get_marker('xfail_issue1142_windows'): - item.add_marker(windows_xfail_marker) - - ## Given From d00f999dcf8aa111e247b7de6b07a920b5ebb24a Mon Sep 17 00:00:00 2001 From: Artur Shaik Date: Mon, 30 Nov 2015 22:27:24 +0600 Subject: [PATCH 2/6] `move_to_end_of_prev_block` without unnecessary command. --- qutebrowser/browser/commands.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 25f0e7378..2207ad8e5 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1611,11 +1611,9 @@ class CommandDispatcher: """ webview = self._current_widget() if not webview.selection_enabled: - act = [QWebPage.MoveToStartOfBlock, QWebPage.MoveToPreviousLine, - QWebPage.MoveToEndOfBlock] + act = [QWebPage.MoveToPreviousLine, QWebPage.MoveToEndOfBlock] else: - act = [QWebPage.SelectStartOfBlock, QWebPage.SelectPreviousLine, - QWebPage.SelectEndOfBlock] + act = [QWebPage.SelectPreviousLine, QWebPage.SelectEndOfBlock] for _ in range(count): for a in act: webview.triggerPageAction(a) From 3a5ce22eacfef435eeb7992897acca97f84532f0 Mon Sep 17 00:00:00 2001 From: Artur Shaik Date: Tue, 1 Dec 2015 13:17:28 +0600 Subject: [PATCH 3/6] Remove unnecessary actions in block jumps. --- qutebrowser/browser/commands.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 2207ad8e5..fddbe959d 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1554,10 +1554,10 @@ class CommandDispatcher: """ webview = self._current_widget() if not webview.selection_enabled: - act = [QWebPage.MoveToEndOfBlock, QWebPage.MoveToNextLine, + act = [QWebPage.MoveToNextLine, QWebPage.MoveToStartOfBlock] else: - act = [QWebPage.SelectEndOfBlock, QWebPage.SelectNextLine, + act = [QWebPage.SelectNextLine, QWebPage.SelectStartOfBlock] for _ in range(count): for a in act: @@ -1573,10 +1573,10 @@ class CommandDispatcher: """ webview = self._current_widget() if not webview.selection_enabled: - act = [QWebPage.MoveToStartOfBlock, QWebPage.MoveToPreviousLine, + act = [QWebPage.MoveToPreviousLine, QWebPage.MoveToStartOfBlock] else: - act = [QWebPage.SelectStartOfBlock, QWebPage.SelectPreviousLine, + act = [QWebPage.SelectPreviousLine, QWebPage.SelectStartOfBlock] for _ in range(count): for a in act: @@ -1592,10 +1592,10 @@ class CommandDispatcher: """ webview = self._current_widget() if not webview.selection_enabled: - act = [QWebPage.MoveToEndOfBlock, QWebPage.MoveToNextLine, + act = [QWebPage.MoveToNextLine, QWebPage.MoveToEndOfBlock] else: - act = [QWebPage.SelectEndOfBlock, QWebPage.SelectNextLine, + act = [QWebPage.SelectNextLine, QWebPage.SelectEndOfBlock] for _ in range(count): for a in act: From 25545617a0f14d5c1a1a0a984bd20ac1814cfc46 Mon Sep 17 00:00:00 2001 From: Artur Shaik Date: Tue, 1 Dec 2015 16:19:13 +0600 Subject: [PATCH 4/6] Try workaround for `win32` platform. --- qutebrowser/browser/commands.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index fddbe959d..95260544c 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -21,6 +21,7 @@ import os import os.path +import sys import shlex import posixpath import functools @@ -1483,11 +1484,16 @@ class CommandDispatcher: """ webview = self._current_widget() if not webview.selection_enabled: - act = QWebPage.MoveToNextWord + act = [QWebPage.MoveToNextWord] + if sys.platform == 'win32': + act.append(QWebPage.MoveToPreviousChar) else: - act = QWebPage.SelectNextWord + act = [QWebPage.SelectNextWord] + if sys.platform == 'win32': + act.append(QWebPage.SelectPreviousChar) for _ in range(count): - webview.triggerPageAction(act) + for a in act: + webview.triggerPageAction(a) @cmdutils.register(instance='command-dispatcher', hide=True, modes=[KeyMode.caret], scope='window', count='count') From c9d47ae92ae954a50e466ffef236dc48657413a3 Mon Sep 17 00:00:00 2001 From: Artur Shaik Date: Tue, 1 Dec 2015 16:53:07 +0600 Subject: [PATCH 5/6] More `win32` workarounds --- qutebrowser/browser/commands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 95260544c..875a6c855 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1505,9 +1505,13 @@ class CommandDispatcher: """ webview = self._current_widget() if not webview.selection_enabled: - act = [QWebPage.MoveToNextWord, QWebPage.MoveToNextChar] + act = [QWebPage.MoveToNextWord] + if sys.platform != 'win32': + act.append(QWebPage.MoveToNextChar) else: - act = [QWebPage.SelectNextWord, QWebPage.SelectNextChar] + act = [QWebPage.SelectNextWord] + if sys.platform != 'win32': + act.append(QWebPage.SelectNextChar) for _ in range(count): for a in act: webview.triggerPageAction(a) From f23af85161748db33118d9dd6f6cc40c978e4f3a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 2 Dec 2015 06:24:34 +0100 Subject: [PATCH 6/6] Regenerate authors. --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 1c1aa4088..8e5adc187 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -151,9 +151,9 @@ Contributors, sorted by the number of commits in descending order: * Claude * meles5 * Patric Schmitz +* Artur Shaik * Nathan Isom * Austin Anderson -* Artur Shaik * Thorsten Wißmann * Alexey "Averrin" Nabrodov * ZDarian