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

* Re: [9fans] An acme question
  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 21:39 ` smiley
  2 siblings, 1 reply; 9+ messages in thread
From: ron minnich @ 2011-04-29 17:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

It sort of does that now, if you double click to (e.g.) immediately to
the right of { or the left of } it selects the block, multi-line or
not. Is this sufficient for you or did I miss something?

ron



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

* Re: [9fans] An acme question
  2011-04-29 16:56 [9fans] An acme question Bakul Shah
  2011-04-29 17:16 ` ron minnich
@ 2011-04-29 17:28 ` John Floren
  2011-04-29 18:28   ` Bakul Shah
  2011-04-29 21:39 ` smiley
  2 siblings, 1 reply; 9+ messages in thread
From: John Floren @ 2011-04-29 17:28 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Apr 29, 2011 at 9:56 AM, Bakul Shah <bakul@bitblocks.com> wrote:
> 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
>
>

Acme can already do most of those things, except that when you double
click on the space between two words ("foo bar"). Since you can't
really click on a character, rather you can only click between two
characters, it ends up selecting the word rather than the phrase. I
personally think this is quite ok.

John



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

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

On Fri, 29 Apr 2011 10:16:17 PDT ron minnich <rminnich@gmail.com>  wrote:
> It sort of does that now, if you double click to (e.g.) immediately to
> the right of { or the left of } it selects the block, multi-line or
> not. Is this sufficient for you or did I miss something?

It is not quite what I want. 1) You have to position the
cursor just at the right spot and 2) it doesn't include the
surrounding brackets.  So if you have


{
alsjakldjd
aldkjaklajsdlka
}

and you click right after {, what gets selected is

alsjakldjd
aldkjaklajsdlka

But thanks! This points out it should be relatively easy!



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

* Re: [9fans] An acme question
  2011-04-29 17:28 ` John Floren
@ 2011-04-29 18:28   ` Bakul Shah
  0 siblings, 0 replies; 9+ messages in thread
From: Bakul Shah @ 2011-04-29 18:28 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, 29 Apr 2011 10:28:06 PDT John Floren <john@jfloren.net>  wrote:
>
> Acme can already do most of those things, except that when you double
> click on the space between two words ("foo bar"). Since you can't
> really click on a character, rather you can only click between two
> characters, it ends up selecting the word rather than the phrase. I
> personally think this is quite ok.

Good point! Here is what I was thinking ("_" below denotes the
locations between chars):

_ _(_ _f_o_o_ _b_a_r_)_
1 2 2 3 3 3 2 4 4 4 2 1

Clicking on 4 locations would select bar.
Clicking on 3 locations would select foo.
Clicking on 2 locations would select ( foo bar).
Clicking on 1 locations would select the surrounding block.



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

* Re: [9fans] An acme question
  2011-04-29 16:56 [9fans] An acme question Bakul Shah
  2011-04-29 17:16 ` ron minnich
  2011-04-29 17:28 ` John Floren
@ 2011-04-29 21:39 ` smiley
  2011-04-29 21:47   ` ron minnich
  2011-04-30  7:06   ` Bakul Shah
  2 siblings, 2 replies; 9+ messages in thread
From: smiley @ 2011-04-29 21:39 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Bakul Shah <bakul@bitblocks.com> writes:

> 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.

If I were filling out an Acme wishlist, I would like to see triple and
quadruple clicks select larger chunks of text.  Being able to do
something like click-click-click-click to "Select All" (in those apps
that support it) is frequently very useful.

I would also move the newline in a "selected line" to the begining of,
rather than the end of, the selection.  It would be much easier to cut
and paste lines if it didn't have to be done from all the way over in
the wee left margin.

--
+---------------------------------------------------------------+
|E-Mail: smiley@zenzebra.mv.com             PGP key ID: BC549F8B|
|Fingerprint: 9329 DB4A 30F5 6EDA D2BA  3489 DAB7 555A BC54 9F8B|
+---------------------------------------------------------------+



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

* Re: [9fans] An acme question
  2011-04-29 21:39 ` smiley
@ 2011-04-29 21:47   ` ron minnich
  2011-04-30  7:06   ` Bakul Shah
  1 sibling, 0 replies; 9+ messages in thread
From: ron minnich @ 2011-04-29 21:47 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Apr 29, 2011 at 2:39 PM,  <smiley@zenzebra.mv.com> wrote:
> Bakul Shah <bakul@bitblocks.com> writes:
>
>> 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.
>
> If I were filling out an Acme wishlist, I would like to see triple and
> quadruple clicks select larger chunks of text.  Being able to do
> something like click-click-click-click to "Select All" (in those apps
> that support it) is frequently very useful.
>
> I would also move the newline in a "selected line" to the begining of,
> rather than the end of, the selection.  It would be much easier to cut
> and paste lines if it didn't have to be done from all the way over in
> the wee left margin.


These are all interesting comments. I suggest you just beat on the
code. Honestly, it's pretty nice in there, you can play to your
heart's content. Give it a go.

ron



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

* Re: [9fans] An acme question
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Bakul Shah @ 2011-04-30  7:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, 29 Apr 2011 21:39:38 -0000 smiley@zenzebra.mv.com  wrote:

> If I were filling out an Acme wishlist, I would like to see triple and
> quadruple clicks select larger chunks of text.  Being able to do
> something like click-click-click-click to "Select All" (in those apps
> that support it) is frequently very useful.

Not a wishlist; just an experiment for some s-expr support.
But need some experience with it to see if it'll be any good.

There are other choices beyond your click^N wish. For instance
the selection size can grow as a function of how long you keep
a mouse button pressed. Or you can make it a function of how
far you drag -- the UPS debugger makes scrolling speed a
function of drag distance.  Very nice!  But until you
implement it and try it out, you won't know if it is any good
or how it will interact with other UI features. Or if there is
a better idea.



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

* Re: [9fans] An acme question
  2011-04-30  7:06   ` Bakul Shah
@ 2011-04-30 12:33     ` erik quanstrom
  0 siblings, 0 replies; 9+ messages in thread
From: erik quanstrom @ 2011-04-30 12:33 UTC (permalink / raw)
  To: 9fans

On Sat Apr 30 03:07:39 EDT 2011, bakul@bitblocks.com wrote:
> On Fri, 29 Apr 2011 21:39:38 -0000 smiley@zenzebra.mv.com  wrote:
>
> > If I were filling out an Acme wishlist, I would like to see triple and
> > quadruple clicks select larger chunks of text.  Being able to do
> > something like click-click-click-click to "Select All" (in those apps
> > that support it) is frequently very useful.
>
> Not a wishlist; just an experiment for some s-expr support.
> But need some experience with it to see if it'll be any good.
>
> There are other choices beyond your click^N wish. For instance
> the selection size can grow as a function of how long you keep
> a mouse button pressed. Or you can make it a function of how
> far you drag -- the UPS debugger makes scrolling speed a
> function of drag distance.  Very nice!  But until you
> implement it and try it out, you won't know if it is any good
> or how it will interact with other UI features. Or if there is
> a better idea.

now that you mention it, i miss the original 9term's mark and
expand-style text selection.  scrolling through a few pages
is quite painful in comparison.

- erik



^ 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).