From a9128846c27307bae1a8154c8bfe8c71acd2c88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 7 Feb 2016 16:06:31 +0100 Subject: vis: export vis_window_closable --- vis-cmds.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'vis-cmds.c') diff --git a/vis-cmds.c b/vis-cmds.c index 3ca7f7b..79d292a 100644 --- a/vis-cmds.c +++ b/vis-cmds.c @@ -429,19 +429,13 @@ static bool cmd_open(Vis *vis, Filerange *range, enum CmdOpt opt, const char *ar return openfiles(vis, &argv[1]); } -static bool is_view_closeable(Win *win) { - if (!text_modified(win->file->text)) - return true; - return win->file->refcount > 1; -} - static void info_unsaved_changes(Vis *vis) { vis_info_show(vis, "No write since last change (add ! to override)"); } static bool cmd_edit(Vis *vis, Filerange *range, enum CmdOpt opt, const char *argv[]) { Win *oldwin = vis->win; - if (!(opt & CMD_OPT_FORCE) && !is_view_closeable(oldwin)) { + if (!(opt & CMD_OPT_FORCE) && !vis_window_closable(oldwin)) { info_unsaved_changes(vis); return false; } @@ -463,7 +457,7 @@ static bool has_windows(Vis *vis) { } static bool cmd_quit(Vis *vis, Filerange *range, enum CmdOpt opt, const char *argv[]) { - if (!(opt & CMD_OPT_FORCE) && !is_view_closeable(vis->win)) { + if (!(opt & CMD_OPT_FORCE) && !vis_window_closable(vis->win)) { info_unsaved_changes(vis); return false; } -- cgit v1.2.3