Fix ;Y on systems not supporting primary selection
Instead we paste clipboard like we already do with some other commands when primary selection is not supported. Fixes #1336
This commit is contained in:
parent
4d9a98a11d
commit
3e6ac28c66
@ -51,6 +51,8 @@ Fixed
|
|||||||
|
|
||||||
- Fixed crash when downloading from an URL with SSL errors
|
- Fixed crash when downloading from an URL with SSL errors
|
||||||
- Close file handles correctly when a download failed
|
- Close file handles correctly when a download failed
|
||||||
|
- Fixed crash when using `;Y` (`:hint links yank-primary`) on a system without
|
||||||
|
primary selection
|
||||||
|
|
||||||
v0.6.2
|
v0.6.2
|
||||||
------
|
------
|
||||||
|
@ -28,6 +28,7 @@ import string
|
|||||||
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl,
|
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl,
|
||||||
QTimer)
|
QTimer)
|
||||||
from PyQt5.QtGui import QMouseEvent
|
from PyQt5.QtGui import QMouseEvent
|
||||||
|
from PyQt5.QtWidgets import QApplication
|
||||||
from PyQt5.QtWebKit import QWebElement
|
from PyQt5.QtWebKit import QWebElement
|
||||||
from PyQt5.QtWebKitWidgets import QWebPage
|
from PyQt5.QtWebKitWidgets import QWebPage
|
||||||
|
|
||||||
@ -490,7 +491,12 @@ class HintManager(QObject):
|
|||||||
url: The URL to open as a QUrl.
|
url: The URL to open as a QUrl.
|
||||||
context: The HintContext to use.
|
context: The HintContext to use.
|
||||||
"""
|
"""
|
||||||
sel = context.target == Target.yank_primary
|
if (context.target == Target.yank_primary and
|
||||||
|
QApplication.clipboard().supportsSelection()):
|
||||||
|
sel = True
|
||||||
|
else:
|
||||||
|
sel = False
|
||||||
|
|
||||||
urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword)
|
urlstr = url.toString(QUrl.FullyEncoded | QUrl.RemovePassword)
|
||||||
utils.set_clipboard(urlstr, selection=sel)
|
utils.set_clipboard(urlstr, selection=sel)
|
||||||
|
|
||||||
|
@ -418,8 +418,8 @@ def clipboard_contains(quteproc, httpbin, what, content):
|
|||||||
|
|
||||||
|
|
||||||
@bdd.then(bdd.parsers.parse('the clipboard should contain:\n{content}'))
|
@bdd.then(bdd.parsers.parse('the clipboard should contain:\n{content}'))
|
||||||
def clipboard_contains_multiline(quteproc, content):
|
def clipboard_contains_multiline(quteproc, httpbin, content):
|
||||||
expected = textwrap.dedent(content)
|
expected = textwrap.dedent(content).replace('(port)', httpbin.port)
|
||||||
quteproc.wait_for(message='Setting fake clipboard: {}'.format(
|
quteproc.wait_for(message='Setting fake clipboard: {}'.format(
|
||||||
json.dumps(expected)))
|
json.dumps(expected)))
|
||||||
|
|
||||||
|
@ -57,3 +57,11 @@ Feature: Using hints
|
|||||||
And I run :hint all spawn -v echo
|
And I run :hint all spawn -v echo
|
||||||
And I run :follow-hint a
|
And I run :follow-hint a
|
||||||
Then the message "Command exited successfully" should be shown
|
Then the message "Command exited successfully" should be shown
|
||||||
|
|
||||||
|
Scenario: Yanking to primary selection without it being supported (#1336)
|
||||||
|
When selection is not supported
|
||||||
|
And I run :debug-set-fake-clipboard
|
||||||
|
And I open data/hints/link.html
|
||||||
|
And I run :hint links yank-primary
|
||||||
|
And I run :follow-hint a
|
||||||
|
Then the clipboard should contain "http://localhost:(port)/data/hello.txt"
|
||||||
|
Loading…
Reference in New Issue
Block a user