From e77c014fa2202f55086668784395d51e070f6fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Diego=20Aur=C3=A9lio=20Mesquita?= Date: Thu, 7 May 2020 15:03:34 -0300 Subject: [PATCH] Ignore ISSET(MULTIBUFFER) when "Ins" is pressed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Diego Aurélio Mesquita --- src/files.c | 11 +++++++++++ src/global.c | 2 +- src/proto.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 1a6cbc05..a59e44d3 100644 --- a/src/files.c +++ b/src/files.c @@ -1277,6 +1277,17 @@ void do_insertfile_void(void) do_insertfile(); } +/* Insert a file but trying to do it in the current buffer first. */ +void do_inserthere_void(void) +{ + bool was_set = ISSET(MULTIBUFFER); + if (was_set) + TOGGLE(MULTIBUFFER); + do_insertfile_void(); + if (ISSET(MULTIBUFFER) != was_set) + TOGGLE(MULTIBUFFER); +} + /* For the given bare path (or path plus filename), return the canonical, * absolute path (plus filename) when the path exists, and NULL when not. */ char *get_full_path(const char *origpath) diff --git a/src/global.c b/src/global.c index f5f63ace..a1c5209d 100644 --- a/src/global.c +++ b/src/global.c @@ -1152,7 +1152,7 @@ void shortcut_init(void) add_to_sclist(MMAIN, "^S", 0, do_savefile, 0); add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0); add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0); - add_to_sclist(MMAIN, "Ins", KEY_IC, do_insertfile_void, 0); + add_to_sclist(MMAIN, "Ins", KEY_IC, do_inserthere_void, 0); if (!ISSET(PRESERVE)) add_to_sclist(MMAIN|MBROWSER|MHELP, "^Q", 0, do_search_backward, 0); add_to_sclist(MMAIN|MBROWSER|MHELP, "^W", 0, do_search_forward, 0); diff --git a/src/proto.h b/src/proto.h index 78172809..810290a4 100644 --- a/src/proto.h +++ b/src/proto.h @@ -292,6 +292,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable); int open_file(const char *filename, bool newfie, FILE **f); char *get_next_filename(const char *name, const char *suffix); void do_insertfile_void(void); +void do_inserthere_void(void); char *get_full_path(const char *origpath); char *safe_tempfile(FILE **f); #ifdef ENABLE_OPERATINGDIR -- 2.17.1