nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit cc593839aab4f842b8a56689fdebaacc6bf98978
parent 1fb25fd2aa6a73ab9c5bd05608dce5773f18bbf1
Author: Chris Allegretta <chrisa@asty.org>
Date:   Wed, 19 Mar 2008 02:32:48 +0000

Fix for 106305: unable to ctrl+c out of save when exiting
Add new YESNO menu for calls to do_yesno_prompt, to enable cancel.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4237 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
Msrc/global.c | 4++--
Msrc/nano.h | 1+
Msrc/prompt.c | 3+++
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -648,7 +648,7 @@ void shortcut_init(bool unjustify) #endif add_to_funcs((void *) cancel_msg, - (MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR), + (MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO), cancel_msg, IFSCHELP(nano_cancel_msg), FALSE, VIEW); add_to_funcs(do_exit, MMAIN, @@ -1140,7 +1140,7 @@ void shortcut_init(bool unjustify) #endif add_to_sclist(MGOTOLINE, "^T", (void *) gototext_msg, 0, FALSE); add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", (void *) new_buffer_msg, 0, FALSE); - add_to_sclist((MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR), + add_to_sclist((MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO), "^C", (void *) cancel_msg, 0, FALSE); add_to_sclist(MHELP, "^X", do_exit, 0, TRUE); add_to_sclist(MHELP, "F2", do_exit, 0, TRUE); diff --git a/src/nano.h b/src/nano.h @@ -438,6 +438,7 @@ typedef struct subnfunc { #define MBROWSER (1<<10) #define MWHEREISFILE (1<<11) #define MGOTODIR (1<<12) +#define MYESNO (1<<13) /* This really isnt all but close enough */ #define MALL (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR|MHELP) diff --git a/src/prompt.c b/src/prompt.c @@ -1247,6 +1247,7 @@ int do_yesno_prompt(bool all, const char *msg) const char *nostr; /* Same for No. */ const char *allstr; /* And All, surprise! */ const sc *s; + int oldmenu = currmenu; assert(msg != NULL); @@ -1308,6 +1309,7 @@ int do_yesno_prompt(bool all, const char *msg) int mouse_x, mouse_y; #endif + currmenu = MYESNO; kbinput = get_kbinput(bottomwin, &meta_key, &func_key); s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); @@ -1358,5 +1360,6 @@ int do_yesno_prompt(bool all, const char *msg) } } while (ok == -2); + currmenu = oldmenu; return ok; }