Ticket #511 (closed enhancement: fixed)
[PATCH] Make Ctrl+Backspace/Delete remove entire words in input controls
| Reported by: | feneur | Owned by: | kenny |
|---|---|---|---|
| Priority: | If Time Permits | Milestone: | Alpha 6 |
| Component: | Core engine | Keywords: | review |
| Cc: |
Description
Currently ctrl+backspace/delete is ignored completely, which is better than how some programs react to it (i.e. placing an "unknown character" box instead of removing the entire word - I'm looking at you Photoshop =) ). It would be nice to have it working like this: Ctrl+Backspace = remove the word to the left of the cursor (i.e. the entire word left of the cursor, nothing to the right of the cursors), Ctrl+Delete the same but on the right side of the cursor.
As you can see by the priority it's not something too important, but it would be nice to have it working, and it can be a good relatively simple task for someone wanting to get more familiar with the engine.
Attachments
Change History
comment:2 Changed 3 years ago by titanforever
- Owner set to titanforever
- Status changed from new to assigned
comment:3 Changed 3 years ago by anonymous
- Milestone Unclassified deleted
Milestone Unclassified deleted
comment:5 Changed 2 years ago by kenny
- Owner changed from titanforever to kenny
- Status changed from assigned to new
comment:6 Changed 2 years ago by kenny
- Status changed from new to assigned
Hmmm... well this one isn't turning out to be so simple after all. The Unicode stuff is a little tricky the way CStrw and Cstr8 are created with the header file swap. Given that, I'm not sure how the best way to handle the unicode macros for iswspace and iswpunct (I need these for detecting unicode word boundaries). They aren't defined when you pull in CStr.h (only in CStr.cpp itself). Probably ought to put those in CStr.h. The real issue though is that I am not getting an event for ctrl-backspace in CInput. It is getting eaten up somewhere lower in the event chain. I guess I will have to go back and figure how the keystroke events are bubbled up into the event system so I can see why we aren't seeing ctrl-backspace.
comment:7 Changed 2 years ago by kenny
Ok, figured out that the key combos needed to be defined as hotkeys in default.cfg and now I am getting the events. I just use the standard iswspace and iswpunct since CInput is always Unicode. So the rest should be easy :).
comment:8 Changed 2 years ago by feneur
Cool :) As you can see it was I who added this ticket :) It's not all that important, but I do tend to press Ctrl+Backspace and wonder why nothing happens =)
comment:9 Changed 2 years ago by kenny
- Keywords review added; simple removed
- Summary changed from Make Ctrl+Backspace/Delete remove entire words in input controls to [PATCH] Make Ctrl+Backspace/Delete remove entire words in input controls
I spent a lot time re-factoring and adding functionality to CInput since it seems we will be using it more and more.
Requested Enhancements
Added "Ctrl+Backspace" for delete word left Added "Ctrl+Delete" for delete word right
Additional Enhancements
Added "Ctrl+LeftArrow?" for move word left (works with select if shift pressed) Added "Ctrl+RightArrow?" for move word right (works with select if shift pressed)
Added mouse double click to select a word
Fixed bug in Clipboard code for Windows - now allows intra-application cut/paste Added "Ctrl+X" for Cut to clipboard Added "Ctrl+C" for Copy to clipboard Above bug fix also fixed problem with "Ctrl+V" paste
comment:10 Changed 2 years ago by feneur
Those extra fixes sounds great :)
comment:11 Changed 2 years ago by jan
- Status changed from assigned to closed
- Resolution set to fixed

The code for this is in gui/CInput.cpp, CInput::ManuallyHandleEvent. It can be tested in e.g. the input controls in the multiplayer join/host setup screens.