Re: [nbdev] Question: Expand Abbreviations action in Java Editor

Tor Norbye <[email protected]>
Newsgroups gmane.comp.java.netbeans.user-interface,gmane.comp.java.netbeans.devel
Message-ID <[email protected]>
Sandip Chitale wrote:

> Can anyone explain how the Expand Abbreviations [abbrev-expand] action 
> in Java Editor works?
>
> Here is the scenario:
> I bound a key stroke (Ctrl+Enter) to Expand Abbreviations 
> [abbrev-expand]  action in Java editor key bindings options.
> [I could not
>
> I have an abbrev:
>
> foria
>
> which should expand to:
>
> for (int i = 0; i < |.length; i ++) {
> }
>
> Now when I type:
>
> foria<SPACE>
>
> the abbreviation expands correctly. This seems to be an implicit key 
> binding.
>
> foria<Ctrl+Enter>
>
> the abbreviation expands correctly too.
>
> However if I type any char like backspace then the abbrev expansion 
> does not work e.g.
>
> foris<BACKSPACE>a<Ctrl+Enter>
>
> then the abbreviation does not expand.
>
> I think the Expand Abbreviations [abbrev-expand] should work as long 
> as the text (word?) before the caret matches  an abbreviation.
>
> Comments? 

My guess is that this was done as a usability fix for those cases when 
you DON'T want the abbreviation. That's not likely with Ctrl+Enter but 
is likely with space.

Let's say you wanted to type the phrase "we're " in a comment. Since "re 
" is an abbreviation for "return" you end up with "we'return ". Now you 
go back and delete it to "we're" and hit space to continue - if it 
always expanded this would become "we'return" again!

So I'm guessing the abbreviations code is only doing abbreviation 
expansion if you type the abbreviation correctly - if you edit around it 
it doesn't.

(This is just speculation but I don't want it to start expanding always 
for the case when space is used as the expand key)

-- Tor
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.