Opened 14 years ago

Closed 13 years ago

Last modified 8 years ago

#511 closed enhancement (fixed)

[PATCH] Make Ctrl+Backspace/Delete remove entire words in input controls

Reported by: Erik Johansson Owned by: Kenny Long
Priority: If Time Permits Milestone: Alpha 6
Component: Core engine Keywords:
Cc: Patch:

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 (1)

CInputEnhancementsAndFixes.patch (23.2 KB ) - added by Kenny Long 13 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by Philip Taylor, 14 years ago

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.

comment:2 by sidharth, 14 years ago

Owner: set to sidharth
Status: newassigned

comment:3 by (none), 14 years ago

Milestone: Unclassified

Milestone Unclassified deleted

comment:4 by Andrew, 14 years ago

Milestone: Backlog

comment:5 by Kenny Long, 13 years ago

Owner: changed from sidharth to Kenny Long
Status: assignednew

comment:6 by Kenny Long, 13 years ago

Status: newassigned

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 by Kenny Long, 13 years ago

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 by Erik Johansson, 13 years ago

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 =)

by Kenny Long, 13 years ago

comment:9 by Kenny Long, 13 years ago

Keywords: review added; simple removed
Summary: Make Ctrl+Backspace/Delete remove entire words in input controls[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 by Erik Johansson, 13 years ago

Those extra fixes sounds great :)

comment:11 by Jan Wassenberg, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [9646]) add support for selection and deletion of entire words in text controls (ctrl+backspace/delete/left/right) based on patch by Chakakhan/kenny (thanks!) also refactored wclipboard closes #511

comment:12 by fabio, 13 years ago

Milestone: BacklogAlpha 6

comment:13 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.