From db6a0d53ca838a1ca7057066436a9e7333354192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Wed, 27 Jan 2016 10:04:24 +0100 Subject: [PATCH] Addressed code-quality remarks --- 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 b254efbcf..6092d3516 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1308,10 +1308,10 @@ class CommandDispatcher: raise cmdexc.CommandError("Element vanished while editing!") @cmdutils.register(instance='command-dispatcher', - modes=[KeyMode.insert], hide=True, scope='window') + modes=[KeyMode.insert], hide=True, scope='window', + needs_js=True) def paste_primary(self): - """Paste the primary selection at cursor position into the curently - selected form field. + """Paste the primary selection at cursor position. """ frame = self._current_widget().page().currentFrame() try: @@ -1324,14 +1324,14 @@ class CommandDispatcher: clipboard = QApplication.clipboard() if clipboard.supportsSelection(): sel = clipboard.text(QClipboard.Selection) - log.misc.debug("Pasting primary selection into element {} " - "(selection is '{}')".format(elem.debug_text(), sel)) + log.misc.debug("Pasting primary selection into element {}".format( + elem.debug_text())) elem.evaluateJavaScript(""" var sel = '{}'; var event = document.createEvent('TextEvent'); event.initTextEvent('textInput', true, true, null, sel); this.dispatchEvent(event); - """.format(sel)) + """.format(webelem.javascript_escape(sel))) def _clear_search(self, view, text): """Clear search string/highlights for the given view.