Bug 163139 - Ctrl+A in search bar selects all in document
Summary: Ctrl+A in search bar selects all in document
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 175412 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-03 15:48 UTC by Robin Pedersen
Modified: 2009-03-05 00:10 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
hacky fix for CTRL+A not working in the search bar (or any line edit) (1.52 KB, patch)
2008-11-18 22:02 UTC, Joseph Wenninger
Details
hacky fix for CTRL+A not working in the search bar (or any line edit) (1.52 KB, patch)
2008-11-18 22:02 UTC, Joseph Wenninger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Pedersen 2008-06-03 15:48:41 UTC
Version:           3.0.80 (using Devel)
Installed from:    Compiled sources
OS:                Linux

Open a document in kate/kwrite, press Ctrl+F to go to the search bar. Enter some text. Press Ctrl+A.

The "select all" action is applied to the document text, instead of the search query. If you right click the search bar and choose "Select all (Ctrl+A)" from the menu, the search query is selected.

The bug only affects Ctrl+A, not other shortcuts that are shared between the document and the line edit like Ctrl+Z, Ctrl+C, Ctrl+V.
Comment 1 FiNeX 2008-06-03 16:21:32 UTC
Confirmed using r816130
Comment 2 Sebastian Pipping 2008-09-18 02:58:28 UTC
I suppose other people experiencing this as a feature not a bug. Can we have more opinions on this one?
Comment 3 Andreas Pakulat 2008-09-18 09:02:58 UTC
This is quite easy: Its a bug. If a widget has focus, the user surely expects all input including shortcuts to act on that widget. Thus Ctrl+A should work on the input lineedit, as it can handle the shortcut. If you press something that doesn't make sense in the lineedit it would be ok to forward to the editor widget.
Comment 4 Randy Kramer 2008-09-18 12:59:48 UTC
+1

If you need any more comments supporting this, or a use case, let me know.
Comment 5 Hugo Rito 2008-11-17 12:12:15 UTC
I was about to report this too.

Many times I tried do replace all the search string with ctrl+a and ended up erasing all my code... Undo to the rescue!!!
Comment 6 Anders Lund 2008-11-17 13:47:02 UTC
It is possible to set the widget context on the action, right?
Comment 7 Robin Pedersen 2008-11-18 08:55:00 UTC
*** Bug 175465 has been marked as a duplicate of this bug. ***
Comment 8 Joseph Wenninger 2008-11-18 21:59:19 UTC
I've investigated a littlebit, the problem is that QLineEdit doesn't catch all CTRL+A key presses, since QtSoftware claims CTRL+A is often used by applications. Since we have CTRL+A in the menu it has priority over all other shortcuts.

I'm attaching a hack to this bug report for testing, because I'm not sure if everybody can live with the behaviour I'm introducing.

The basic idea is that the "select all" action, if invoked, checks if it has  the QKeySequence::SelectAll keyboard shortcut assigned if yes, it checks if the currently focused widget is a QLineEdit. If this is the case it invokes the selectAll of member function of the lineedit, otherwise it selects all in the document.
The missbehaviour of this implementation is that a focused line edit has priority over the kateview even if the action is invoked via the menu.

I think my proposed solution is better than nothing and if everybody is fine with the "missbehaviour" I'm going to commit the hacky fix, till we have a better one.
Comment 9 Joseph Wenninger 2008-11-18 22:02:06 UTC
Created attachment 28679 [details]
hacky fix for CTRL+A not working in the search bar (or any line edit)
Comment 10 Joseph Wenninger 2008-11-18 22:02:31 UTC
Created attachment 28680 [details]
hacky fix for CTRL+A not working in the search bar (or any line edit)
Comment 11 Anders Lund 2008-11-18 22:15:09 UTC
This problem must be common to quite a few applications, so I wonder if it is worth suggesting to qt that the behavior is changed? And even if not, we should come up with a solution that can be applied to other apps too (I'm not suggesting that Jowenns suggested hack can not ;).

Any application that has the very common select action combined with embedded dialogs will be affected, if I am not mistaken?
Comment 12 Ivo Anjo 2008-11-19 17:23:30 UTC
Anders is right: this also happens in dolphin, with the filter bar (Tools > Show filter bar).

If you have the filter bar focused and press ctrl+a, it selects all files instead of the text in the filter bar.

Although I would argue that in dolphin's case it's useful behavior, Qt should allow the apps to specify what to do with ctrl+A.
Comment 13 Joseph Wenninger 2008-11-21 23:22:21 UTC
Since I didn't get a clear no-go, I've committed my hacky fix, till somebody comes up with a better solution. I'm not marking this bugas fixed, since a "real fix is pending" -> REMIND
See also: http://websvn.kde.org/?view=rev&revision=887419
Comment 14 Joseph Wenninger 2008-11-22 20:52:40 UTC
*** Bug 175412 has been marked as a duplicate of this bug. ***
Comment 15 Joseph Wenninger 2008-11-22 20:54:06 UTC
Added an additional check for lineedits in comboboxes (url navigator in filesystem browser)
r887764
Comment 16 Ivo Anjo 2009-03-04 22:46:37 UTC
I was scanning the 4.2.1 changelog and found bug #181180 that supposedly solves this for all klineedits and ktextedits, so maybe it's time to revert the hacky fix?
Comment 17 FiNeX 2009-03-04 23:07:06 UTC
Indeed, I've just tried to remove the "hacky fix" and the bug is gone :-)

If needed, I can commit the fix for the fix.
Comment 18 Dominik Haumann 2009-03-04 23:42:54 UTC
The related commits are: r887764 and part of r887419
And of course, if you tested it already, go ahead and commit/revert it!
Comment 19 FiNeX 2009-03-05 00:07:41 UTC
@Dominik: yes, about r887419 I've reverted only the chages to kateview.cpp and kateview.h.

I'll check again the code and I'll submit the changes.
Comment 20 FiNeX 2009-03-05 00:10:57 UTC
SVN commit 935384 by finex:

Reverted temporary fix to CTRL+A bug which has been fixed on a deeper level now.

BUG: 163139



 M  +1 -25     kateview.cpp  
 M  +0 -2      kateview.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=935384