Bug 211557 - You cannot use the Shift+Arrow keys to select text in input fields in rekonq
Summary: You cannot use the Shift+Arrow keys to select text in input fields in rekonq
Status: RESOLVED FIXED
Alias: None
Product: rekonq
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Unspecified
: NOR normal
Target Milestone: ---
Assignee: Andrea Diamantini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-23 16:55 UTC by Panagiotis Papadopoulos
Modified: 2010-04-06 01:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Panagiotis Papadopoulos 2009-10-23 16:55:37 UTC
Version:            (using Devel)
Installed from:    Compiled sources

You cannot use the Shift+Arrow keys to select text in input fields in rekonq.
Howto reproduce:
Browse to e.g. http://www.google.com/ and type in anything.
Then hold the shift key and press the left/right arrow key.

This is very likely caused by the webview scrolling. (Because when pressing Shift + Arrow up in a input field like this one, instead of selecting the line above the current one, rekonq starts scrolling.

:-)
Comment 1 Andrea Diamantini 2009-10-23 17:36:01 UTC
On Friday 23 October 2009 16:55:37 Panagiotis Papadopoulos wrote:
> https://bugs.kde.org/show_bug.cgi?id=211557
> 
>            Summary: You cannot use the Shift+Arrow keys to select text in
>                     input fields in rekonq
>            Product: rekonq
>            Version: unspecified
>           Platform: Compiled Sources
>         OS/Version: unspecified
>             Status: NEW
>           Severity: normal
>           Priority: NOR
>          Component: general
>         AssignedTo: adjam7@gmail.com
>         ReportedBy: pano_90@gmx.net
> 
> 
> Version:            (using Devel)
> Installed from:    Compiled sources
> 
> You cannot use the Shift+Arrow keys to select text in input fields in
>  rekonq. Howto reproduce:
> Browse to e.g. http://www.google.com/ and type in anything.
> Then hold the shift key and press the left/right arrow key.
> 
> This is very likely caused by the webview scrolling. (Because when pressing
> Shift + Arrow up in a input field like this one, instead of selecting the
>  line above the current one, rekonq starts scrolling.
> 
> :-)
> 

Do you think that switching to CTRL key will fix this? Or are we going to break 
something else?
Comment 2 Panagiotis Papadopoulos 2009-10-23 17:38:49 UTC
yeah, it would break the CTRL + Arrow actions ("jump over a word").
Isn't it possible to "disable" automatic webview scrolling when an input field has the focus?

That would probably be the cleanest way.
Comment 3 Ronny Scholz 2009-10-24 11:19:35 UTC
It works for me with current git and Qt 4.5.2
Comment 4 Panagiotis Papadopoulos 2009-10-25 13:23:44 UTC
Has been fixed in the meantime
(the automatic scrolling had to be disabled though)
Comment 5 Mark Williamson 2010-04-03 20:16:30 UTC
I'm seeing this behaviour with commit ce03d5d4687f7d789ddfacdd51c4281eb9193487 - compiled today from git.
Comment 6 Panagiotis Papadopoulos 2010-04-03 20:20:14 UTC
confirmed here with 0.4.58.
Isn't it possible to detect, if the cursor is in a text field, and then disable the auto scroll feature temporarily, until the cursor has been moved out of the text field?
Comment 7 Andrea Diamantini 2010-04-06 01:18:29 UTC
commit 969efc9bddcc1b21d1c70f301d8cb0d44904c9c5
Author: Andrea Diamantini <adjam7@gmail.com>
Date:   Tue Apr 6 01:20:04 2010 +0200

    I confused mouse cursor with the key one :)
    Here is another hack to fix bug 211557
    
    DISCLAIMER: this, as the previous, is an hack NOT a solution
    
    BUG: 211557

diff --git a/src/webview.cpp b/src/webview.cpp
index 2083cef..e874411 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -66,6 +66,7 @@ WebView::WebView(QWidget* parent)
     , _scrollTimer( new QTimer(this) )
     , _VScrollSpeed(0)
     , _HScrollSpeed(0)
+    , _disableAutoScroll(false)
 {
     WebPage *page = new WebPage(this);
     setPage(page);
@@ -320,6 +321,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
 
 void WebView::mousePressEvent(QMouseEvent *event)
 {
+    QWebHitTestResult result = page()->mainFrame()->hitTestContent( event->pos() );
+    _disableAutoScroll = result.isContentEditable();
+    
     switch(event->button())
     {
       case Qt::XButton1:
@@ -426,9 +430,7 @@ void WebView::keyPressEvent(QKeyEvent *event)
         }
     }
  
-    QWebHitTestResult result = page()->mainFrame()->hitTestContent( mapFromGlobal( QCursor::pos() ) );
-    
-    if( result.isContentEditable() )
+    if(_disableAutoScroll)
     {
         KWebView::keyPressEvent(event);
         return;
diff --git a/src/webview.h b/src/webview.h
index 85ebf46..0fe83ae 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -79,6 +79,7 @@ private:
     QTimer *_scrollTimer;
     int _VScrollSpeed;
     int _HScrollSpeed;
+    bool _disableAutoScroll;
 };
 
 #endif