Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] [StyledText] Filtering out Ctrl/Alt key combinations

There's a bug (http://dev.eclipse.org/bugs/show_bug.cgi?id=21268) that requests that the StyledText widget filter out all Ctrl and Alt key combinations.

On Windows, Ctrl+<character> combinations get translated into special 
characters (which are shown in some ASCII tables). Ctrl+J for example is 
LF, Ctrl+M is CR. These are inserted in the plain text widget and in the 
Windows rich text widget and are not filtered out (although Wordpad does 
filter them out). StyledText always inserts CR, LF and TAB regardless of 
the Ctrl/Alt state mask in the key event.

The problem is Linux/Motif. Our key listener doesn't get translated 
characters in the key event but just the plain character with the Ctrl 
statemask. Consequently StyledText inserts J in the text if you press 
Ctrl+J. The plain SWT Text widget does get translated characters, just like on 
Windows, and inserts them in the text.

We previously fixed a bug 
(http://dev.eclipse.org/bugs/show_bug.cgi?id=12952) and filter out Alt 
character combinations so that unused menu mnemonics don't get inserted 
into the text. In light of that it seems reasonable to ask that StyledText 
filter out Ctrl character combinations as well, if it weren't for the fact 
that Windows and possibly other platforms translates them into special 
characters.

It would be easy for an application (e.g., Eclipse text editors) to filter 
out any Ctrl or Alt decorated characters if we don't fix this but you 
couldn't get the old behavior back if StyledText filters out Ctrl key 
combinations.

What does the community think about this? Should StyledText filter out all 
non-plain characters (i.e., all characters that have a Ctrl or Alt state 
mask) or should this be left to the application?
Do any other platforms (Gtk, Mac,...) translate Ctrl key combinations like 
Windows does? (I'll check Gtk myself, an excuse to try out the Gtk 
version).

Knut


Back to the top