vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 2029ccf3a1e500d6efda46944b9bbdf225674648 parent 46e77dfe1095ea33a8b7769f9a8feb6e9a8999b5 Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 18 Jan 2016 21:01:35 +0100 vis: fix segfault upon :qall Diffstat:
| M | vis-cmds.c | | | 10 | ++++++---- |
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/vis-cmds.c b/vis-cmds.c @@ -489,14 +489,16 @@ static bool cmd_bdelete(Vis *vis, Filerange *range, enum CmdOpt opt, const char static bool cmd_qall(Vis *vis, Filerange *range, enum CmdOpt opt, const char *argv[]) { for (Win *next, *win = vis->windows; win; win = next) { next = win->next; - if (!text_modified(vis->win->file->text) || (opt & CMD_OPT_FORCE)) + if (!win->file->internal && (!text_modified(win->file->text) || (opt & CMD_OPT_FORCE))) vis_window_close(win); } - if (!has_windows(vis)) + if (!has_windows(vis)) { vis_exit(vis, EXIT_SUCCESS); - else + return true; + } else { info_unsaved_changes(vis); - return vis->windows == NULL; + return false; + } } static bool cmd_read(Vis *vis, Filerange *range, enum CmdOpt opt, const char *argv[]) {