Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Jérôme Fouletier is currently offline Jérôme FouletierFriend
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 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
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 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
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
Re: AltGr and Ctrl key interact with content assist [message #647042 is a reply to message #647010] Tue, 04 January 2011 09:36 Go to previous messageGo to next message
Jérôme Fouletier is currently offline Jérôme FouletierFriend
Messages: 39
Registered: September 2010
Location: France
Member
I use windows XP professional with latest service packs, French localization and keyboard. I can't do it now, but I'll try the same test on x86 32 bit Linux.
Re: AltGr and Ctrl key interact with content assist [message #647048 is a reply to message #647042] Tue, 04 January 2011 10:25 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Jerome,

I don't think that its worth the effort to try it on a linux box. I
guess we'll have to mimic JDTs behaviour for this use case more closely
even if I don't like the yellow background that much.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 04.01.11 10:36, schrieb Jerome:
> I use windows XP professional with latest service packs, French
> localization and keyboard. I can't do it now, but I'll try the same test
> on x86 32 bit Linux.
Previous Topic:utility of scoping
Next Topic:how to deal with a non context free lexing issue
Goto Forum:
  


Current Time: Fri Apr 26 03:24:55 GMT 2024

Powered by FUDForum. Page generated in 0.02538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top