From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: PATCH: narrow-to-region (was Re: This widget implementation feels a bit clunky)
Date: Mon, 20 Jul 2015 09:29:20 -0700 [thread overview]
Message-ID: <150720092920.ZM13868@torch.brasslantern.com> (raw)
In-Reply-To: <9927.1437383950@thecus.kiddle.eu>
On Jul 20, 11:19am, Oliver Kiddle wrote:
} Subject: Re: PATCH: narrow-to-region (was Re: This widget implementation f
}
} Bart wrote:
} > } It'd also be good for the function to use the new undo limit features.
} >
} > I was going to send a follow-up message about undo-ing and whether a call
} > to split-undo is needed before (and/or after) the recursive-edit.
}
} It is needed immediately after you've setup PREDISPLAY and emptied
} BUFFER.
The sourceforge outage is getting a bit annoying with respect to passing
these patches back and forth.
} > Related, should -S / -R implicitly set undo points?
}
} I've never used those two options and am not sure I quite understand
} what they're for. At least not without digging in the archives. With the
} patch below, it is fairly obviously broken for them because
} _ntr_changeno is set in a different block from the one which does zle
} undo to revert to it.
The -S and -R options are basically a hack to because there's no good way
to do a callback mechansim. What you'd like is to replace recursive-edit
with a call back into the invoking scope, but you can't do that without
real closures or at least real namerefs, so "narrow-to-region -S" does
everything up to recursive-edit and then saves state, followed by -R
which restores state and picks up where -S left off.
If you introduce new variables _ntr_savelim and _ntr_changeno those are
going to have to be added to the state save/restore, or else they have
to be localized to the part where recursive-edit is called and NOT the
parts where state is saved/restored.
Also this --
} PREDISPLAY=$_ntr_predisplay
} POSTDISPLAY=$_ntr_postdisplay
} - LBUFFER="$_ntr_lbuffer$BUFFER"
} - RBUFFER="$_ntr_rbuffer"
} + LBUFFER="$_ntr_lbuffer$_ntr_newlbuf"
} + RBUFFER="$_ntr_newrbuf$_ntr_rbuffer"
} MARK=${#_ntr_lbuffer}
-- breaks MARK and CURSOR again, you need
LBUFFER="$_ntr_lbuffer$_ntr_newlbuf$_ntr_newrbuf"
RBUFFER="$_ntr_rbuffer"
to get CURSOR in the right place. Which means you may as well not save
the left and right buffers separately to begin with.
next prev parent reply other threads:[~2015-07-20 16:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-20 9:16 This widget implementation feels a bit clunky (edit-quoted-word) Mikael Magnusson
2015-06-20 17:06 ` Peter Stephenson
2015-06-21 7:09 ` Mikael Magnusson
2015-06-21 17:17 ` Peter Stephenson
2015-06-22 2:26 ` Mikael Magnusson
2015-06-22 0:18 ` PATCH: Document narrow-to-region -l and -r Mikael Magnusson
2015-06-20 17:21 ` This widget implementation feels a bit clunky (edit-quoted-word) Bart Schaefer
2015-07-18 23:42 ` PATCH: narrow-to-region (was Re: This widget implementation feels a bit clunky) Bart Schaefer
2015-07-19 3:55 ` Oliver Kiddle
2015-07-19 8:23 ` Bart Schaefer
2015-07-20 9:19 ` Oliver Kiddle
2015-07-20 16:29 ` Bart Schaefer [this message]
2015-07-23 5:41 ` Undo and narrow-to-region (was Re: PATCH: narrow-to-region (was ...)) Bart Schaefer
2015-07-27 15:44 ` Oliver Kiddle
2015-08-12 17:00 ` PATCH: Re: Undo and narrow-to-region (was ...) Oliver Kiddle
2015-08-17 21:15 ` Daniel Hahler
2015-08-17 21:58 ` Bart Schaefer
2015-08-18 3:43 ` Bart Schaefer
2015-08-18 7:05 ` Bart Schaefer
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=150720092920.ZM13868@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).