Move cursor to end of textboxes when hinting.
This commit is contained in:
parent
9d716d74b4
commit
0fcd016427
@ -24,10 +24,12 @@ import functools
|
|||||||
import subprocess
|
import subprocess
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl
|
from PyQt5.QtCore import (pyqtSignal, pyqtSlot, QObject, QEvent, Qt, QUrl,
|
||||||
|
QTimer)
|
||||||
from PyQt5.QtGui import QMouseEvent, QClipboard
|
from PyQt5.QtGui import QMouseEvent, QClipboard
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
from PyQt5.QtWebKit import QWebElement
|
from PyQt5.QtWebKit import QWebElement
|
||||||
|
from PyQt5.QtWebKitWidgets import QWebPage
|
||||||
|
|
||||||
from qutebrowser.config import config
|
from qutebrowser.config import config
|
||||||
from qutebrowser.keyinput import modeman, modeparsers
|
from qutebrowser.keyinput import modeman, modeparsers
|
||||||
@ -392,6 +394,10 @@ class HintManager(QObject):
|
|||||||
]
|
]
|
||||||
for evt in events:
|
for evt in events:
|
||||||
self.mouse_event.emit(evt)
|
self.mouse_event.emit(evt)
|
||||||
|
if elem.is_text_input() and elem.is_editable():
|
||||||
|
QTimer.singleShot(0, functools.partial(
|
||||||
|
elem.webFrame().page().triggerAction,
|
||||||
|
QWebPage.MoveToEndOfDocument))
|
||||||
|
|
||||||
def _yank(self, url, context):
|
def _yank(self, url, context):
|
||||||
"""Yank an element to the clipboard or primary selection.
|
"""Yank an element to the clipboard or primary selection.
|
||||||
|
@ -277,6 +277,12 @@ class WebElementWrapper(collections.abc.MutableMapping):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def is_text_input(self):
|
||||||
|
"""Check if this element is some kind of text box."""
|
||||||
|
roles = ('combobox', 'textbox')
|
||||||
|
tag = self._elem.tagName().lower()
|
||||||
|
return self.get('role', None) in roles or tag in ('input', 'textarea')
|
||||||
|
|
||||||
def debug_text(self):
|
def debug_text(self):
|
||||||
"""Get a text based on an element suitable for debug output."""
|
"""Get a text based on an element suitable for debug output."""
|
||||||
self._check_vanished()
|
self._check_vanished()
|
||||||
|
Loading…
Reference in New Issue
Block a user