vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 6c78bbe105c0d01a647fd79f2e579cbdaf79b41e parent 60efeb3e14fff6700f3ba75ca43d7ef00f76868d Author: Randy Palamar <randy@rnpnr.xyz> Date: Sun, 12 Jan 2025 08:09:34 -0700 sam: fix small oversight in cmd_filter This was the only place where buffer_move was actaully doing something useful. Diffstat:
| M | sam.c | | | 8 | ++++---- |
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sam.c b/sam.c @@ -1745,10 +1745,10 @@ static bool cmd_filter(Vis *vis, Win *win, Command *cmd, const char *argv[], Sel if (vis->interrupted) { vis_info_show(vis, "Command cancelled"); } else if (status == 0) { - if (!sam_change(win, sel, range, bufout.data, bufout.len, 1)) { - free(bufout.data); - bufout.data = 0; - } + char *data = bufout.data; + bufout.data = 0; + if (!sam_change(win, sel, range, data, bufout.len, 1)) + free(data); } else { vis_info_show(vis, "Command failed %s", buffer_content0(&buferr)); }