zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Bug in undo/redo handling in conjunction with history-beginning-search-backward
Date: Thu, 2 Jun 2016 15:09:18 -0700	[thread overview]
Message-ID: <160602150918.ZM21143@torch.brasslantern.com> (raw)
In-Reply-To: <22810.1464880333@thecus.kiddle.eu>

On Jun 2,  5:12pm, Oliver Kiddle wrote:
}
} bracketed-paste-magic does fc -p which invalidates HISTNO.
} 
} So one undo blanks the whole line; a second undo tries to move to
} history line 0 - which fails.

Oof.

} fc -p/-P are not part of zle so don't save histline. This also explains
} why change 8 has a history line of 803 instead of 804. Use of fc -p
} within zle appears to be unique to bracketed-paste-magic.

Functions/Misc/sticky-note also uses it within ZLE, and has for years.

} What is the
} reason for using it? Are you trying to block history widgets even where
} they are listed in active-widgets?

That's the reason in bracketed-paste-magic; in sticky-note it differs.
History motions should be able to move around within the pasted text
(up-line-or-history) but not out of the paste into the actual history.

In sticky-note, an alternate history is substituted and the intention
is to let you move around and interact within it.

} So does anyone have any thoughts on how to handle this. The simplest is
} for fc -p/-P to detect zle being active and print an error.

That would be unfortunate.

} Perhaps we need some module callbacks for pushing and popping history.
} Zle would hook the callback, save histline and somehow mark this in
} the undo structure.

Either that, or perhaps there's some way for undo to detect that the
history has changed since the last time an undo point was recorded?
I'm not familiar with how the history push/pop works internally.

} I attach a patch to the state saving and restoring in
} bracketed-paste-magic. Don't expect this to fix anything. I did it to
} make things easier to understand. Was there a reason for half the state
} saving/restoring to be outside the if statement?

Basically (a) I first implemented it without using split-undo and (b) I
didn't trust undo to save and restore everything correctly for the context
needed by the paste-finish functions.


      reply	other threads:[~2016-06-02 22:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20  5:25 Mikael Magnusson
2016-05-25  1:02 ` Oliver Kiddle
2016-06-02  7:22   ` Bart Schaefer
2016-06-02 15:12     ` Oliver Kiddle
2016-06-02 22:09       ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160602150918.ZM21143@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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