Additional fixes

This commit is contained in:
Artur Shaikhullin 2017-12-06 13:58:23 +06:00
parent ed1d036077
commit 890e26b2b5
5 changed files with 8 additions and 3 deletions

View File

@ -65,6 +65,8 @@ class CommandDispatcher:
def __init__(self, win_id, tabbed_browser):
self._win_id = win_id
self._tabbed_browser = tabbed_browser
self.yank_object = {}
self.userscript_object = {}
def __repr__(self):
return utils.get_repr(self)
@ -883,6 +885,7 @@ class CommandDispatcher:
message.info("{} {} yanked to {}".format(
len(s), "char" if len(s) == 1 else "chars", target))
if not self.yank_object['keep']:
log.procs.debug(self.yank_object['keep'])
modeman.leave(self._win_id, KeyMode.caret, "yank selected",
maybe=True)
self.yank_object = None

View File

@ -184,6 +184,7 @@ class WebEngineCaret(browsertab.AbstractCaret):
@pyqtSlot(usertypes.KeyMode)
def _on_mode_left(self):
self.drop_selection()
self._tab.run_js_async(
javascript.assemble('caret', 'toggle'))
@ -284,7 +285,6 @@ class WebEngineCaret(browsertab.AbstractCaret):
# https://bugreports.qt.io/browse/QTBUG-53134
self._tab.run_js_async(
'window.getSelection().toString()', callback)
self.drop_selection()
def _follow_selected_cb(self, js_elem, tab=False):
"""Callback for javascript which clicks the selected element.

View File

@ -338,6 +338,7 @@ class WebKitCaret(browsertab.AbstractCaret):
def selection(self, html=False, callback=False):
if html:
callback(self._widget.selectedHtml())
else:
callback(self._widget.selectedText())
def follow_selected(self, *, tab=False):

View File

@ -1051,6 +1051,7 @@ window._qutebrowser.caret = (function() { // eslint-disable-line max-statements,
funcs.moveToEndOfDocument = () => {
CaretBrowsing.move("forward", "documentboundary");
window.scrollTo(0, document.body.scrollHeight);
};
funcs.dropSelection = () => {

View File

@ -17,10 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=unused-import
import pytest
import pytest_bdd as bdd
# pylint: disable=unused-import
from end2end.features.test_yankpaste_bdd import init_fake_clipboard
bdd.scenarios('caret.feature')