Fix pasting of empty URLs.
This commit is contained in:
parent
2f9ec515db
commit
14042403f6
@ -826,11 +826,11 @@ class CommandDispatcher:
|
|||||||
mode = QClipboard.Clipboard
|
mode = QClipboard.Clipboard
|
||||||
target = "Clipboard"
|
target = "Clipboard"
|
||||||
text = clipboard.text(mode)
|
text = clipboard.text(mode)
|
||||||
if not text:
|
if not text.strip():
|
||||||
raise cmdexc.CommandError("{} is empty.".format(target))
|
raise cmdexc.CommandError("{} is empty.".format(target))
|
||||||
log.misc.debug("{} contained: '{}'".format(target,
|
log.misc.debug("{} contained: '{}'".format(target,
|
||||||
text.replace('\n', '\\n')))
|
text.replace('\n', '\\n')))
|
||||||
text_urls = enumerate(u for u in text.split('\n') if u)
|
text_urls = enumerate(u for u in text.split('\n') if u.strip())
|
||||||
for i, text_url in text_urls:
|
for i, text_url in text_urls:
|
||||||
if not window and i > 0:
|
if not window and i > 0:
|
||||||
tab = False
|
tab = False
|
||||||
|
@ -210,6 +210,7 @@ def selection_supported(qapp):
|
|||||||
def fill_clipboard(qtbot, qapp, httpbin, what, content):
|
def fill_clipboard(qtbot, qapp, httpbin, what, content):
|
||||||
mode = _clipboard_mode(qapp, what)
|
mode = _clipboard_mode(qapp, what)
|
||||||
content = content.replace('(port)', str(httpbin.port))
|
content = content.replace('(port)', str(httpbin.port))
|
||||||
|
content = content.replace(r'\n', '\n')
|
||||||
|
|
||||||
clipboard = qapp.clipboard()
|
clipboard = qapp.clipboard()
|
||||||
with qtbot.waitSignal(clipboard.changed):
|
with qtbot.waitSignal(clipboard.changed):
|
||||||
|
@ -61,6 +61,11 @@ Feature: Yanking and pasting.
|
|||||||
And I run :paste --sel
|
And I run :paste --sel
|
||||||
Then the error "Primary selection is empty." should be shown
|
Then the error "Primary selection is empty." should be shown
|
||||||
|
|
||||||
|
Scenario: Pasting with a space in clipboard
|
||||||
|
When I put " " into the clipboard
|
||||||
|
And I run :paste
|
||||||
|
Then the error "Clipboard is empty." should be shown
|
||||||
|
|
||||||
Scenario: Pasting in a new tab
|
Scenario: Pasting in a new tab
|
||||||
Given I open about:blank
|
Given I open about:blank
|
||||||
When I run :tab-only
|
When I run :tab-only
|
||||||
@ -171,6 +176,18 @@ Feature: Yanking and pasting.
|
|||||||
- active: true
|
- active: true
|
||||||
url: http://localhost:*/data/hello3.txt
|
url: http://localhost:*/data/hello3.txt
|
||||||
|
|
||||||
|
Scenario: Pasting multiple urls with an empty one
|
||||||
|
When I open about:blank
|
||||||
|
And I put "http://localhost:(port)/data/hello.txt\n\nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
||||||
|
And I run :paste -t
|
||||||
|
Then no crash should happen
|
||||||
|
|
||||||
|
Scenario: Pasting multiple urls with an almost empty one
|
||||||
|
When I open about:blank
|
||||||
|
And I put "http://localhost:(port)/data/hello.txt\n \nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
||||||
|
And I run :paste -t
|
||||||
|
Then no crash should happen
|
||||||
|
|
||||||
#### :paste-primary
|
#### :paste-primary
|
||||||
|
|
||||||
Scenario: Pasting the primary selection into an empty text field
|
Scenario: Pasting the primary selection into an empty text field
|
||||||
|
Loading…
Reference in New Issue
Block a user