Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: AW: [platform-text-dev] Add "delete previous word" and "delete next word" actions to eclipse editor

The word navigation methods at the SWT/StyledText level provide a generic 
default implementation. It's good to have them in general, they just don't 
do what Kai wants them to do in the Java editor.
If you think that StyledText should provide a default delete next/previous 
word action then you should enter a bug against Platform/SWT and append 
the changes you made to StyledText (bug 29027 is not quite suitable 
because it mixes SWT and Platform UI concepts which is confusing). This 
default behavior should match whatever the word navigation does.

Since the platform text editor does not do anything special for word 
navigation (Kai indicates it should) I think it would be ok for the time 
being to just use the default StyledText implementation of delete word, 
should it be added. I don't see why word delete should work using the 
proper Java editor definition of a word (whatever that may be) if word 
navigation doesn't.

Kai mentions locale dependency for finding words. I think word navigation 
and deletion should ultimately work just like the mouse double click 
strategy, assuming mouse double click selects a word.

Knut




"Tomasz Stanczak" <tomasz@xxxxxxxxxxxxxx>
Sent by: platform-text-dev-admin@xxxxxxxxxxx
02/03/2003 12:53 PM
Please respond to platform-text-dev

 
        To:     <platform-text-dev@xxxxxxxxxxx>
        cc: 
        Subject:        AW: [platform-text-dev] Add "delete previous word" and "delete  next word" 
actions to eclipse editor



Kai,

yes I guess you're right, since StyledText is not context-aware it
shouldn't be placed at that level - provided it should be possible to
take different actions for deleting words depending on different
content at the caret position. Yet as you've mentioned
navigating/selecting words:

StyledText.java:
doSelectionWordNext()
doSelectionWordPrevious()
doWordNext()
doWordPrevious()

are all at the same level - this was the main reason I put the code at
StyledText.

Now regardless of the fact where it should go ideally, I think it
should go at the same place as those other methods - "go to the next
word" should find words the same way as "select next word" and "delete
next word".

So ideally all of them should be placed at more context-aware place
(which I didn't yet find), but the fact is that those methods are in
StyledText, and if "delete word" belongs at the same place as those
methods it could also stay there.

And frankly speaking it wouldn't really bother me if the word breaking
works "java-wise" in the comments, too, if only it does allow deleting
words - exactly as it doesn't bother me that selecting words by the
keyboard works as it works. I prefer better recognition of Java tokens
than natural language words within the Java editor.

But of course I don't know the big picture in your (Eclipse active
developers') heads, it might be that it's better to refrain from
implementing those actions at wrong place, since you're going to
refactor StyledText anyway including all word recognition strategies.

However: it would be a pity if we couldn't have "delete word" 
functionality
now because there is no time to make a better solution.

BTW. put following into JavaDoc comment:

"de.bhw.rz001.test.TestWls"

now double-click on "bhw" and then on "test". The mouse double-click
strategy being different than the key selection strategy does make it
wrong, dividing the word after "rz001", which is neither the end of the
right Java token nor the natural word. Feels awkward.

I have opened a bug regarding this behaviour, I have seen that you've
changed its status to RESOLVED/WONTFIX. Given the fact, that is's
java.test.BreakIterator and that you want a different behaviour than in 
Java
code I think that's all right.

Tomasz

PS. I've sent this message to the list from my web account
tomasz63@xxxxxxxx, it awaits the approval of the mailing-list moderator -
well, now it can be discarded.

Since I have no access to my main mail account from where I work I'm 
afraid
I won't be able to post messages during the day. I have set it up

I think I won't be able to post into the list, since I have no access to 
my
main account from where I work.

-----Ursprungliche Nachricht-----
Von: platform-text-dev-admin@xxxxxxxxxxx
[mailto:platform-text-dev-admin@xxxxxxxxxxx]Im Auftrag von Kai-Uwe
Maetzel
Gesendet: Montag, 3. Februar 2003 13:02
An: platform-text-dev@xxxxxxxxxxx
Betreff: Re: [platform-text-dev] Add "delete previous word" and "delete
next word" actions to eclipse editor


Tomasz,

Your patch locates this functionality at the SWT level.  This is in sync
with the navigation actions such as "position cursor after the next word".
Like the navigation actions your implementation uses the StyledText
internal methods to determine the start/end of a word. Those methods are
based on white space detection and the distinction between letters and
digits.

The StyledText is used to implement text editors. There is no assumption
about the kind of text that can be edited in such editors. Take the Java
editor as one example. A single Java compilation unit may contain Java 
code
and comments. The StyledText methods are powerful enough for the Java code
but not for the comments. This is because the contents of  the comments is
more or less natural language and the language defines the rules for the
word boundaries. Thus, depending on the active locale, delete 
next/previous
word potentially behaves differently in the code or comment sections of a
single Java compilation unit. This should also be the case for the
navigation actions and it is a lack in the text editor implementation that
it does not.

A similar problem is the double click behavior of the Java editor. This
actually is different in the code and the comment sections. In the code
sections, it computes word boundaries simply by calls to the predicates
defined in the class Character.  In the comment sections, it detects word
boundaries by instances of the class BreakIterator that it creates for the
active locale.

Kai


At 07:39 PM 2/2/2003 +0100, you wrote:
>Hi all,
>
>I had been missing both above actions, so I implemented them based on 
v2.1
>M4 source. The attachment with the code has been posted on Bugzilla along
>the bug# 29027.
>
>Tomasz
>
>_______________________________________________
>platform-text-dev mailing list
>platform-text-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/platform-text-dev

_______________________________________________
platform-text-dev mailing list
platform-text-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-text-dev



_______________________________________________
platform-text-dev mailing list
platform-text-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-text-dev





Back to the top