Discussion:
[Nano-devel] dropping an anchor at a place where wants to return
Benno Schulenberg
2018-10-28 16:41:01 UTC
Permalink
Hi all,

Something that I regularly do is: I want to look somewhere else in
the file but want to return to the place where I currently am. So,
first I type: xxx. Then I go look elsewhere in the file, often with
a ^W. And when I'm done looking, I type: ^W xxx <Enter> and delete
the three exes.

I do this often enough that today I made a function that makes the
antics easier. Patch is coming up. Anyone who would like to see
this included?

Benno
David Ramsey
2018-10-29 18:12:54 UTC
Permalink
Something that I regularly do is: I want to look somewhere else in the
file but want to return to the place where I currently am.
<snip>
I do this often enough that today I made a function that makes the
antics easier. Patch is coming up.
I do this fairly often myself, too.
Anyone who would like to see this included?
I would.
Victor Khong - Horsefly Realty
2018-10-29 20:02:56 UTC
Permalink
Anyone who would like to see this included?
I would.
Yes, I would also like to see this feature included.

Victor Khong
Benno Schulenberg
2018-10-31 18:51:56 UTC
Permalink
Anyone who would like to see this included?
I would.
Yes, I would also like to see this feature included. 
Okay. So there is some interest in this feature. But... how
exactly should this work? And maybe you (David, Victor, ...)
find the mechanism proposed by Marco better?

For the anchoring, I can imagine three forms of functioning:

1) As the patch proposed: if there is no anchor, M-' sets it;
if there is an anchor and the cursor sits on it, then the anchor
is cleared; if the cursor is elsewhere than the anchor, the cursor
jumps to the anchor. But this risks the user forgetting to clear
the anchor, and when she wants to set it elsewhere... the cursor
unexpectedly and frustratingly jumps.

2) If there is no anchor, M-' sets it; otherwise, the cursor jumps
to the anchor *and* clears it. This prevents the user forgetting
to clear the anchor. This only risks the user forgetting to have
set an anchor, and then the cursor jumping when wanting to set an
anchor.

3) M-" always sets the anchor; M-' jumps to it. Clearing the
anchor is not needed. But this eats up two keystrokes. And
somehow I find typing Shift+Alt+key quite awkward.

Benno
David Ramsey
2018-10-31 19:30:01 UTC
Permalink
Okay. So there is some interest in this feature. But... how exactly
should this work? And maybe you (David, Victor, ...) find the
mechanism proposed by Marco better?
I'd actually prefer Marco's mechanism. I'd usually make use of only one
anchor, but there are times where there are two or three places I need
to jump to, and his way allows for more than one.

For example, if I have to deal with several instances of a global's
being used in one source file, I currently have to do a bunch of extra
searching and finagling if I want to jump between that many places, and
having a few anchors would make it much easier. (I had to do this a few
times when I was refactoring justify to make it undoable, and this would
have saved me some significant time.)
<snip>
3) M-" always sets the anchor; M-' jumps to it. Clearing the anchor
is not needed.
Of your three forms, this makes the most sense to me. Although Marco's
way of having one key to toggle an anchor, and two other keys to jump
forward and backward between anchors makes even more sense, given that
it fits with moving forward and backward between multiple buffers,
searching forward and backward, etc.
But this eats up two keystrokes.
If they're needed for proper navigation, that's not so much of an issue
(and this also applies to the hypothetical three in Marco's version).
And somehow I find typing Shift+Alt+key quite awkward.
Agreed. But Esc followed by Shift-' for " should work just as well,
shouldn't it? Having the option of Esc before such sequences makes it
somewhat easier for me, since having to hold down several keys for an
extended period can sometimes be rather wearying for me.
Benno Schulenberg
2018-11-03 18:43:25 UTC
Permalink
Post by David Ramsey
I'd actually prefer Marco's mechanism. I'd usually make use of only one
anchor, but there are times where there are two or three places I need
to jump to, and his way allows for more than one.
Jumping to two or three places should be easy enough with M-W and M-Q,
no? For the example that you give with a global, searching for it and
then jumping to the different occurrences with M-W and M-Q should be
even easier than setting a bookmark: it saves striking a combo to set
the bookmark. (If there are globals whose names are not distinct enough
for this to work, then I consider this a "bug" and a renaming patch is
in order.) But I know what you mean: bookmarking the places of interest
and then being able to cycle through these places sounds attractive. I
just can't see myself using it.
Post by David Ramsey
3) M-" always sets the anchor; M-' jumps to it. Clearing the anchor
is not needed.
Of your three forms, this makes the most sense to me.
It has the least surprises.
Post by David Ramsey
But this eats up two keystrokes.
If they're needed for proper navigation, that's not so much of an issue
(and this also applies to the hypothetical three in Marco's version).
It is an issue. There are almost no free key combos left, so I want
to assign them sparingly. And I want to make it easier to remember
what combo to press for which function -- when there are two for the
anchoring: which was which again? If you press drop instead of jump,
you've lost the point where you wanted to return.
Post by David Ramsey
And somehow I find typing Shift+Alt+key quite awkward.
Agreed. But Esc followed by Shift-' for " should work just as well,
shouldn't it?
It would work, but... I find it at least as awkward as a three-finger
combo.

Benno
David Ramsey
2018-11-07 19:28:35 UTC
Permalink
Post by Benno Schulenberg
Jumping to two or three places should be easy enough with M-W and M-Q,
no? For the example that you give with a global, searching for it and
then jumping to the different occurrences with M-W and M-Q should be
even easier than setting a bookmark: it saves striking a combo to set
the bookmark. (If there are globals whose names are not distinct
enough for this to work, then I consider this a "bug" and a renaming
patch is in order.)
Okay. However, I do work on code other than nano sometimes, and that
other code doesn't necessarily follow this rule, in which case the
bookmarks would be a better option. And even in nano, there are times I
want to jump to a place *around* a global rather than directly on it;
jumping to the global and then manually scrolling up or down can be
problematic if I accidentally scroll one line too many.
Post by Benno Schulenberg
But I know what you mean: bookmarking the places of interest and then
being able to cycle through these places sounds attractive. I just
can't see myself using it.
You may not see yourself using it, but some others would.
Post by Benno Schulenberg
It is an issue. There are almost no free key combos left, so I want
to assign them sparingly.
Point, but in this case, it may as well be necessary. See below.
Post by Benno Schulenberg
And I want to make it easier to remember what combo to press for which
function -- when there are two for the anchoring: which was which
again? If you press drop instead of jump, you've lost the point where
you wanted to return.
In Marco's version, there aren't two for the anchoring. There's one for
"add bookmark if not on bookmark, remove bookmark if on bookmark", one
for "jump to previous bookmark", and one for "jump to next bookmark".

The first of these doesn't have your problem with pressing drop instead
of jump, since the jump keys are separate from the add/drop key. Having
the add/drop key relatively far away from the jump keys is actually a
good idea, since it's harder to hit by accident. And with the statusbar
messages for add/drop, if you accidentally drop when you mean to add,
fixing that is just a matter of pressing the key again.

However, your proposed patch, with one key acting as "add bookmark",
"clear bookmark", and "jump to bookmark" depending on context, is
susceptible to this problem. It may be simpler in terms of using fewer
keys, but combining jump with add/drop can lead to worse problems than
using one more key. To compare with Marco's version: if you
accidentally drop when you mean to add, it may be possible to fix it by
pressing the key again, except if it makes you jump to the next bookmark
instead, in which case you have to jump back, etc.

As I brought up with regard to softmark, I have enough problems with
regard to an occasional finger-twitch screwing things up. I can easily
undo text issues caused by that. Clearing and jumping to/from
bookmarks, I can't. So putting add/drop on a separate key, as Marco's
version does, will save me some aggravation when using bookmarks.
Post by Benno Schulenberg
It would work, but... I find it at least as awkward as a three-finger
combo.
There's probably some other key we can use for this case, then.
Marco Diego Aurélio Mesquita
2018-11-08 00:31:43 UTC
Permalink
Post by David Ramsey
Post by Benno Schulenberg
It would work, but... I find it at least as awkward as a three-finger
combo.
There's probably some other key we can use for this case, then.
How about <Alt+Insert> to toggle bookmarks, <Alt+PgUp> and
<Alt+PgDown> to cycle?
Benno Schulenberg
2018-11-11 12:41:10 UTC
Permalink
Post by Marco Diego Aurélio Mesquita
How about <Alt+Insert> to toggle bookmarks, <Alt+PgUp> and
<Alt+PgDown> to cycle?
Yes, those would be much better bindings. They make some sense.
I can imagine using those.

Benno
Benno Schulenberg
2018-11-08 18:55:38 UTC
Permalink
Post by David Ramsey
And even in nano, there are times I
want to jump to a place *around* a global rather than directly on it;
jumping to the global and then manually scrolling up or down can be
problematic if I accidentally scroll one line too many.
You and Marco are capable enough to make a bookmark feature, but in
the past years neither of you has made anything like it. So I doubt
that you really have any need for bookmarks.

I proposed the (single) anchoring mechanism because I observed what
I actually do now and then.

But as we can't agree on the mechanism, I'll let it be. I'll carry
a local patch and see if I will actually start to use the anchor.
Updated patch is coming up.
Post by David Ramsey
Post by Benno Schulenberg
And I want to make it easier to remember what combo to press for which
function -- when there are two for the anchoring: which was which
again? If you press drop instead of jump, you've lost the point where
you wanted to return.
In Marco's version, there aren't two for the anchoring. [...]
I was talking about anchoring there, not about bookmarks. So I was
talking about my proposed mechanism. If you call an anchor a bookmark
too, or bookmarking anchoring, it gets confusing.

Benno
David Ramsey
2018-11-08 22:50:23 UTC
Permalink
Post by Benno Schulenberg
You and Marco are capable enough to make a bookmark feature, but in
the past years neither of you has made anything like it.
Marco hasn't been around here that long compared to me, and I've been
busy with other things (some coding, mostly real life). And while it's
true that I haven't used it before, it would be a more efficient way to
do what I've currently been doing in a less efficient way, just as with,
say, the executable command history.

As for what being busy has to do with anything, see below.
Post by Benno Schulenberg
So I doubt that you really have any need for bookmarks.
And now I'm through being diplomatic.

I'd have more time to code features like this (when I have coding time,
which is less often lately, which is why the only major rewrite I have
pending is undoable justify, and I would really appreciate it if other
people could help test it) if I didn't have to deal with a bunch of
coding nits caused by new code or newly rewritten code, some of which
are admittedly mine, but many of which lately are your doing. All these
things like rearranging shortcuts for cosmetic purposes, which breaks
key interpretation in the help viewer and/or file browser; adding
support for keycodes without necessarily adding support for their escape
sequences as well, which breaks modified key support on the BSDs and/or
elsewhere; etc.

As I said before when we were unsuccessfully trying to hash out the
256-color support, *DO NOT* tell me what I mean (which includes not
telling me what I really need, and not telling me what I'm really
thinking). By your own logic, and as shown by the majority of the code
you've contributed, you're capable enough to add a whole lot of features
and/or fix a lot of bugs, but you haven't done a lot of the more complex
ones in the past few years (as shown by some of the years-old entries in
the bug and patch trackers). Am I to assume that you don't really need
any of those features added, or those bugs fixed, because you haven't
gotten to them yet?

I've been focusing on more of the old problems than the new just to
finally get them fixed, because no one else seems to be working on them.
I've worked more on undoable mass indent/unindent. alternative
spell-check, and justify so that all major functions are at last
undoable, which should have been the case years ago. Undo is an
important feature, and, frankly, it makes the project look bad to have
it be incomplete for this long. So if I haven't done much with
bookmarks, it's because I've been prioritizing, aside from when I get
inspired on more minor issues; you'll note that the other patches I've
proposed haven't involved entirely new features or massive rewrites of
existing ones.
Post by Benno Schulenberg
I proposed the (single) anchoring mechanism because I observed what I
actually do now and then.
Point.
Post by Benno Schulenberg
But as we can't agree on the mechanism, I'll let it be. I'll carry a
local patch and see if I will actually start to use the anchor.
Updated patch is coming up.
Fine. Although I still say having one key do both a jump and a clear
will cause usability issues down the line; if the feature goes in that
way, I probably won't use it that often, even if you do.
Benno Schulenberg
2018-11-11 13:06:24 UTC
Permalink
I'd have more time to code features like this [...]
if I didn't have to deal with a bunch of
coding nits caused by new code or newly rewritten code, some of which
are admittedly mine, but many of which lately are your doing.
You're complaining about the quality of the changes I make?
You want to take over? You want to be maintainer of nano?
Please, go ahead.
All these
things like rearranging shortcuts for cosmetic purposes, which breaks
key interpretation in the help viewer and/or file browser;
Very minor breakage: the <Bsp> key not scrolling backward any more,
something probably no one uses. I added it a while ago just for
some "compatibility" with the 'info' reader.
adding
support for keycodes without necessarily adding support for their escape
sequences as well, which breaks modified key support
It breaks nothing; it just fails to add support for them. Oversights.
Those escape sequences are not on my radar.
you haven't done a lot of the more complex
ones in the past few years
I haven't done any of the complex stuff ever. I don't have the stamina
for that.
Am I to assume that you don't really need
any of those features added, or those bugs fixed, because you haven't
gotten to them yet?
Yes, I don't absolutely need those things added or fixed, because
I have learned to work around them. But I haven't gotten to them,
because they demand a too large investment of time and focus.

Benno

Loading...