9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] An acme question
@ 2011-04-29 16:56 Bakul Shah
  2011-04-29 17:16 ` ron minnich
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Bakul Shah @ 2011-04-29 16:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Here's something for a brief respite from linux bashing....

In acme, at present a single click positions the cursor, a
double click selects either the word under the cursor or the
entire line, depending on the cursor position.

What I would like to do is to the change logic as follows: If
you double *on* a word, the word is selected. If you double
click on white space or a bracket, a whole block is selected,
where a block is defined by matching brackets -- (), {} or [].
This property should be settable on a per window basis.

Example: given

{ fee [({ foo bar}) [and so on]] }
           1 2   3456           7

Double clicking at 1 selects foo,
at 2 or 3 selects the phrase { foo bar},
at 4 selects the phrase ({ foo bar}),
at 5 selects the phrase [({ foo bar}) [and so on]],
at 6 selects the phrase [and so on],
at 7 selects the entire { fee [({ foo bar}) [and so on]] } etc.
Note: a block need not fit on one line.

A further enhancement: doubleclicking in a selected block
expands the selection to the surrounding block, without moving
the cursor.

Is this doable or too painful?  I took a quick look but
couldn't immediately see how.  If doable, how would I go about
it?  I was thinking of keeping a list of matched string pairs
(REs might be too powerful) and look for one of left strings
earlier in the file. When one is found, look for the matching
right string later in the file. If none found, select to the
very end.

Surely someone has already tried this?

Thanks,

--bakul



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-04-30 12:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-29 16:56 [9fans] An acme question Bakul Shah
2011-04-29 17:16 ` ron minnich
2011-04-29 17:30   ` Bakul Shah
2011-04-29 17:28 ` John Floren
2011-04-29 18:28   ` Bakul Shah
2011-04-29 21:39 ` smiley
2011-04-29 21:47   ` ron minnich
2011-04-30  7:06   ` Bakul Shah
2011-04-30 12:33     ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).