Macro get_word()?

YT Lim ytlim23 at yahoo.com.au
Thu Jan 25 08:49:28 CET 2007


Tony,

Your routine works exactly as I wanted. Thanks!

Is there a way to put this "word" into the
string_dialog() so that it is editable by the user? 

/Y.T.

--- Tony Balinski <ajbj at free.fr> wrote:

> Quoting Bert Wesarg
> <wesarg at informatik.uni-halle.de>:
> 
> > Yes,
> >
> > this is my actual code, to check if $cursor is on
> a right word boundary:
> >
> > define is_right {
> >     rwb = -1
> >     if ($cursor > 0) {
> >         rwb = search(">", $cursor - 1, "forward",
> "regex")
> >     } else if ($cursor < $text_length) {
> >         rwb = search(">", $cursor + 1, "backward",
> "regex")
> >     }
> >     if ($cursor != rwb) {
> >         return 0
> >     }
> >     return 1
> > }
> 
> You want a predicate to test the current position.
> Why not just:
>      return search(">", $cursor, "regex")
> which is much the same as
>      return search("(?<=\\w)(?=\\W|$)", $cursor,
> "regex") == $cursor
> 
> Likewise for lwb: "<" or "?<=^|\\W)(?=\\w)"
> 
> Tony
> -- 
> NEdit Discuss mailing list - Discuss at nedit.org
> http://www.nedit.org/mailman/listinfo/discuss
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 


More information about the Discuss mailing list