Opened 12 years ago
Closed 11 years ago
#9586 closed bug (fixed)
Using the keyboard to select whole words
Reported by: | Kev | Owned by: | stippi |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Applications/WebPositive | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | x86 |
Description
Haiku lacks a feature from Windows that can be pretty handy. When you are selecting with the keyboard, you can hold down Ctrl while pressing Shift+arrow to select a word at a time. Would this be difficult to implement OS-wide?
Change History (8)
comment:1 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
Component: | User Interface → Applications/WebPositive |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
My bad, it's specific to Web+.
comment:3 by , 11 years ago
WebKit has the code for this, but BWindow eats the keyboard events when the command key is pressed. I don't understand how BTextView manages to get the events anyway. Can someone help with that?
comment:4 by , 11 years ago
You probably want to call BView::MakeFocus()
on the webkit rendering BView. Even for keyboard events that don't involve the command key (down arrow, page down ..etc) it's good practice[*], and in the case of command-something it probably bypasses the BWindow code that is related to AddShortcut() and eats up "shortcuts". There's little to no downside to doing that, because even if the focus view does not know how to handle an event, that event will be forwarded up the BView hierarchy, something like the "Delegator(sp)" design pattern.
[*] And maybe it's related to a small bug I've noticed: page-down ..etc does not always work; e.g. if you do command-T to create a tab, then type an address or select a bookmark to load a page, that page won't be navigable... until you click inside it (BView::MouseDown() probably calls MakeFocus() I believe); I think keyboard events are even sent to the /previous/ tab, ie if I come back to the previously displayed tab I see it scrolled down..! Could file a ticket about that, but it sounds like it'd be a duplicate of this one [in root cause, if not in symptoms].
comment:5 by , 11 years ago
I think the view gets focus properly. How else would it get the other events (arrow keys, typing text in textfields, etc). Only events with the command key pressed are filtered, and this matches the code in BWindow if I'm reading it properly.
comment:6 by , 11 years ago
Regarding the suspicion that BWindow always eats command-xyz events, good point -- just realized that the "return true" here http://cgit.haiku-os.org/haiku/tree/src/kits/interface/Window.cpp#n3803
is outside of the if(shortcut != NULL) , weird.
I guess the only way this works out for BTextView is this return false
, meaning that keyboard events are not specifically targetted at the CurrentFocus() view (sounds reasonable right?).
As to the behavior of arrow-key messages, as noted above it does not always work. In my experience it depends on how the tab was created, if you clicked inside it ..etc. Sometimes I press arrow-down and get no response at all, until I click the view. Had to do that (clicking) just now when responding to this ticket for example.
EDIT: so to solve this riddle I guess it will take some tracing, something like overriding DispatchMessage() to make it printf() the result of _IsFocusMessage(event)
and _FindShortcut(key, modifiers)
...
EDIT 2: as well as printf("%p...", target)
to see if this block gets a chance to call KeyDown() at all.
I won't even try to find who or what defines _TopLevelFilter()
that's too hairy for me *g*
comment:7 by , 11 years ago
Further investigation shows that BTextView registers the shortcuts (in _Activate), and calls its _HandleArrowKeys when receiving the message. We need to do something similar in BWebView and turn the shortcuts back into WebKit keyboard events.
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in https://github.com/haiku/webkit/commit/94b274b1a64d3162ec6beeff7404971974d5f3c0. Will be part of the next Web+ release.
We already have this. I believe it's cmd+shift in our case though.