Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;
        h=from:message-id:date:in-reply-to:comments:references:to:subject
         :mime-version;
        bh=umheL3kYbuYrVwcdDaOaF+HySTwboSenjnBgP/juusM=;
        b=dnNZXSw/5nQThiW50OVY5SRRmFvdfaik4F1proxuFI2IoHJVSGVKEJ0Q++HKW5BTUI
         kUAEGK1+bwxRUkaEn1YQpIIHby0fboBbHtksl8PLTo0OWS0qdVVarsh15Esk5qb2Wc4e
         hsVH3kZI/+nq1lgAqUhuT0GnLQEVJAV0F5LmG4xYDzilM+gc8b/Z595NvRxFcPiFLQaA
         Ve48EFRgDMB3kJoBsUaPekRNSfJYBhSA4EZgdei37tP/WlrrMskn/TGMaPHKS+IQA1WG
         k8s69xF2j357TjW1lRaMKbCtSEF6F9XeD+GmR+XwG23IcrFXL+LvJkP1e5Jg+o1kKBe9
         ULUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:date:in-reply-to:comments
         :references:to:subject:mime-version;
        bh=umheL3kYbuYrVwcdDaOaF+HySTwboSenjnBgP/juusM=;
        b=iJIC5x4mFuNE1Lt8qiOKoewHQ95a/NSxmWbHBdk50ftn9UWvLHGITsPx/pX7Zn/1hG
         guY0UHQzRObCY5qk1hr1372+N5971s/N/FYQYFprMzL21XJwNYkkNUnt2UnaEsyDlC2Y
         LANM6YyAbhTU79KnwTNtdwwd1gWEEV+aVI2YiidLNKdsssgPcfErmqGi/vfVUL365OYt
         BiGZ7OFM+Abw82n2sQzrHClQr3pBQIUQ1YvTvlfLV9pApBw2z/+RxkJ64RNh9ZTFU81S
         Xw0w4Nk1n+jIEBd1qES4IjS1H6PAZdGdPZJ+fyjRAi021eCKux0wiMiexNFX/THKLIYo
         vudQ==
X-Gm-Message-State: ALyK8tJEKgBBa6GQ6KZwk1FfwwwWw2EC0qdH3em4By6Dd54JO9EqZHox560hmce2583EUw==
X-Received: by 10.66.222.98 with SMTP id ql2mr417560pac.137.1464905359796;
        Thu, 02 Jun 2016 15:09:19 -0700 (PDT)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160602150918.ZM21143@torch.brasslantern.com>
Date: Thu, 2 Jun 2016 15:09:18 -0700
In-Reply-To: <22810.1464880333@thecus.kiddle.eu>
Comments: In reply to Oliver Kiddle <okiddle@yahoo.co.uk>
        "Re: Bug in undo/redo handling in conjunction with history-beginning-search-backward" (Jun  2,  5:12pm)
References: <CAHYJk3TPHXFx96mm-40hvEqnd__8v8mnebiZ1r+thxGorZz=qg@mail.gmail.com> 
	<7795.1464138176@thecus.kiddle.eu> 
	<160602002257.ZM14758@torch.brasslantern.com> 
	<22810.1464880333@thecus.kiddle.eu>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Bug in undo/redo handling in conjunction with history-beginning-search-backward
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 38583

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.

