Home » Modeling » TMF (Xtext) » AltGr and Ctrl key interact with content assist(Unwanted selection when pressing right alt key)
AltGr and Ctrl key interact with content assist [message #646970] |
Mon, 03 January 2011 16:51 |
Jérôme Fouletier Messages: 39 Registered: September 2010 Location: France |
Member |
|
|
In XText editors (including the editor for grammar and generated editors) when the content assist menu is displayed, if the user presses the right alt key, the editor selects the token or whitespace after the cursor. The right alt key, usually is used as a "second" shift key to access a third character on a given key, which does not traditionally appear on some keyboards, like [, ], @, € or ^. When the corresponding character key is pressed, the previously selected characters are deleted, causing syntax errors..
Unwanted selection also appears when pressing Crtl, but it is less severe since Ctrl-key usually is not used to enter explicit text.
Could this be due to an interaction with some key bindings? I could not find any key binding specifically addressing the right alt key, but since Ctrl seems involved as well, it could be related.
|
|
|
Re: AltGr and Ctrl key interact with content assist [message #647009 is a reply to message #646970] |
Tue, 04 January 2011 00:24 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Jerome,
this sounds like a bug in
ConfigurableCompletionProposal#apply(ITextViewer viewer, char trigger,
int stateMask, int offset) where the keymask is only checked for CTRL
but not for the absense of ALT. You can fix this by using a subclass of
the ConfigurableCompletionProposal and this condition for the local
variable 'replaceRight':
boolean replaceRight = (stateMask & SWT.CTRL) != 0 && (stateMask &
SWT.ALT) == 0;
The selection is actually a feature as it allows to toggle between
insertion of override when the proposal is applied (JDT does something
similar).
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 03.01.11 17:51, schrieb Jerome:
> In XText editors (including the editor for grammar and generated
> editors) when the content assist menu is displayed, if the user presses
> the right alt key, the editor selects the token or whitespace after the
> cursor. The right alt key, usually is used as a "second" shift key to
> access a third character on a given key, which does not traditionally
> appear on some keyboards, like [, ], @, € or ^. When the corresponding
> character key is pressed, the previously selected characters are
> deleted, causing syntax errors..
> Unwanted selection also appears when pressing Crtl, but it is less
> severe since Ctrl-key usually is not used to enter explicit text.
>
> Could this be due to an interaction with some key bindings? I could not
> find any key binding specifically addressing the right alt key, but
> since Ctrl seems involved as well, it could be related.
|
|
|
Re: AltGr and Ctrl key interact with content assist [message #647010 is a reply to message #647009] |
Tue, 04 January 2011 01:01 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Jerome,
it turns out that my assumption was wrong. The problem is the burried in
ConfigurableCompletionProposal#selected where the selection is set
instead of a pure visual indicator. However, I'd assume that it should
only be set when only CTRL is pressed. What platform do you use?
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 04.01.11 01:24, schrieb Sebastian Zarnekow:
> Hi Jerome,
>
> this sounds like a bug in
> ConfigurableCompletionProposal#apply(ITextViewer viewer, char trigger,
> int stateMask, int offset) where the keymask is only checked for CTRL
> but not for the absense of ALT. You can fix this by using a subclass of
> the ConfigurableCompletionProposal and this condition for the local
> variable 'replaceRight':
>
> boolean replaceRight = (stateMask & SWT.CTRL) != 0 && (stateMask &
> SWT.ALT) == 0;
>
> The selection is actually a feature as it allows to toggle between
> insertion of override when the proposal is applied (JDT does something
> similar).
>
> Regards,
> Sebastian
|
|
| | |
Goto Forum:
Current Time: Fri Apr 26 03:24:55 GMT 2024
Powered by FUDForum. Page generated in 0.02538 seconds
|