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
|
||||
- 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
|
||||
------
|
||||
|
@ -28,6 +28,7 @@ import string
|
||||
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl,
|
||||
QTimer)
|
||||
from PyQt5.QtGui import QMouseEvent
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from PyQt5.QtWebKit import QWebElement
|
||||
from PyQt5.QtWebKitWidgets import QWebPage
|
||||
|
||||
@ -490,7 +491,12 @@ class HintManager(QObject):
|
||||
url: The URL to open as a QUrl.
|
||||
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)
|
||||
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}'))
|
||||
def clipboard_contains_multiline(quteproc, content):
|
||||
expected = textwrap.dedent(content)
|
||||
def clipboard_contains_multiline(quteproc, httpbin, content):
|
||||
expected = textwrap.dedent(content).replace('(port)', httpbin.port)
|
||||
quteproc.wait_for(message='Setting fake clipboard: {}'.format(
|
||||
json.dumps(expected)))
|
||||
|
||||
|
@ -57,3 +57,11 @@ Feature: Using hints
|
||||
And I run :hint all spawn -v echo
|
||||
And I run :follow-hint a
|
||||
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