9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] +- in acme
@ 2010-04-19  7:12 Rudolf Sykora
  2010-04-19 12:07 ` erik quanstrom
  0 siblings, 1 reply; 4+ messages in thread
From: Rudolf Sykora @ 2010-04-19  7:12 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

I was now a bit surprised when using the '+-' idiom in acme.
So far I've always used it to select the whole 'current' line.
That works ok as long as one is somewhere 'inside' the line.
However, when I am just at its beginning, like before 'H' on this
line, it selects the previous line.
Is this how the behaviour was meant?

Thanks
Ruda



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

* Re: [9fans] +- in acme
  2010-04-19  7:12 [9fans] +- in acme Rudolf Sykora
@ 2010-04-19 12:07 ` erik quanstrom
  2010-04-19 12:59   ` Rudolf Sykora
  0 siblings, 1 reply; 4+ messages in thread
From: erik quanstrom @ 2010-04-19 12:07 UTC (permalink / raw)
  To: 9fans

On Mon Apr 19 03:14:14 EDT 2010, rudolf.sykora@gmail.com wrote:
> Hello,
>
> I was now a bit surprised when using the '+-' idiom in acme.
> So far I've always used it to select the whole 'current' line.
> That works ok as long as one is somewhere 'inside' the line.
> However, when I am just at its beginning, like before 'H' on this
> line, it selects the previous line.
> Is this how the behaviour was meant?

the idiom is -+  try + then - one-at-a-time and you'll see why.

- erik



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

* Re: [9fans] +- in acme
  2010-04-19 12:07 ` erik quanstrom
@ 2010-04-19 12:59   ` Rudolf Sykora
  2010-04-19 16:02     ` roger peppe
  0 siblings, 1 reply; 4+ messages in thread
From: Rudolf Sykora @ 2010-04-19 12:59 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> the idiom is -+  try + then - one-at-a-time and you'll see why.
>
> - erik
>

Well, ok, -+ works in any case, so it's actually what I usually need.
Still I don't fully understand.
The man page says:

Some useful idioms: a1+- (a1-+) selects
the line containing the end (beginning) of a1.

Isn't it that an empty dot has the same beginning and end?
Isn't it that my dot (here place 'just before the beginning 'I' of
this sentence) is on the same line as the 'I' itself?
Moreover, even if the beginning and end wouldn't be identical for my
case, I'd still expect that the beginning is before the end... (so
that +- would have a better chance to match my line!).

Thanks
Ruda



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

* Re: [9fans] +- in acme
  2010-04-19 12:59   ` Rudolf Sykora
@ 2010-04-19 16:02     ` roger peppe
  0 siblings, 0 replies; 4+ messages in thread
From: roger peppe @ 2010-04-19 16:02 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

this seems like a bug to me - it doesn't follow the description
in the manual page. the end of the empty selection at the
start of a line is surely within that line.

i had a look at the code, and was surprised by the fact that
the logic appears to implemented in two places;
middle clicking "Edit +" executes lineaddr() where
right clicking ":+" goes through number().

in both cases, the code checks whether the character 1 before
the end of the selection is '\n' which only works if the selection
is non-null.

a simple fix in lineaddr might look like this:

			if(sign==0 || addr.r.q1==0){
				p = 0;
				n = 1;
			}else if(addr.r.q1 > addr.r.q0){
				p = addr.r.q1-1;
				n = textreadc(f->curtext, p++)=='\n';
			}else{
				p = addr.r.q0;
				n = 0;
			}

this issue is made more awkward by the fact that the selection
at the start of a line is included when the line before it is
entirely selected - in some sense it's actually in both lines.

i think it's worth adding a special case for the null selection,
but others' mileages may vary.


On 19 April 2010 13:59, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
>> the idiom is -+  try + then - one-at-a-time and you'll see why.
>>
>> - erik
>>
>
> Well, ok, -+ works in any case, so it's actually what I usually need.
> Still I don't fully understand.
> The man page says:
>
> Some useful idioms: a1+- (a1-+) selects
> the line containing the end (beginning) of a1.
>
> Isn't it that an empty dot has the same beginning and end?
> Isn't it that my dot (here place 'just before the beginning 'I' of
> this sentence) is on the same line as the 'I' itself?
> Moreover, even if the beginning and end wouldn't be identical for my
> case, I'd still expect that the beginning is before the end... (so
> that +- would have a better chance to match my line!).
>
> Thanks
> Ruda
>
>



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

end of thread, other threads:[~2010-04-19 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19  7:12 [9fans] +- in acme Rudolf Sykora
2010-04-19 12:07 ` erik quanstrom
2010-04-19 12:59   ` Rudolf Sykora
2010-04-19 16:02     ` roger peppe

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