#983490 menu.c, more.c: add the code for K_MIME

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-02-25 00:51:04 UTC
Severity:
normal
Tags:
#983490#5
Date:
2021-02-25 00:46:21 UTC
From:
To:
Dear Maintainer,

  I forgott to send this patch,
it comes after "nntp.c: fix use of ipport_nntp".

Author: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>

    Add "K_MIME" to "menu.c" and "more.c"

      Add "K_MIME" to "menu.c" and "more.c".

    Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
diff --git a/menu.c b/menu.c
index efd0746..f5c70dc 100644
--- a/menu.c
+++ b/menu.c
@@ -1502,6 +1502,7 @@ new_state:
 	case K_UNSHAR:
 	case K_PATCH:
 	case K_UUDECODE:
+	case K_MIME:

 	    if (numa < 0)
 		goto nextmenu;
@@ -1513,7 +1514,7 @@ new_state:
     cancel1:
 	    enable_stop = 0;
 	    save_selected = 0;
-	    doing_unshar = k_cmd == K_UNSHAR || k_cmd == K_PATCH;
+	    doing_unshar = k_cmd == K_UNSHAR || k_cmd == K_PATCH || k_cmd == K_MIME;
 	    did_unshar = 0;

 	    m_startinput();
diff --git a/more.c b/more.c
index 8a1987a..99280e0 100644
--- a/more.c
+++ b/more.c
@@ -1218,6 +1218,7 @@ alt_key:
 	case K_UNSHAR:
 	case K_PATCH:
 	case K_UUDECODE:
+	case K_MIME:
 	    news_save = news;
 	    digest_save = digest;

@@ -1225,13 +1226,21 @@ alt_key:
 	    if (init_save(c, (char **) NULL) != NULL) {
 		if (c == K_UNSHAR)
 		    prompt_line = Lines - 2;
-
+		if (c == K_MIME)
+		    unset_raw();
 		save(ah);
 		end_save();
+		if (c == K_MIME) { /* otherwise arrows do not work */
+		    /* From run_shell(":", x, 0); x can be -1, 0 or 1 */
+		    /* Can this be simplified ? */
+		    int was_raw = visual_off();
+		    visual_on();
+		    if (was_raw) nn_raw();
+		}
 	    }
 	    news = news_save;
 	    digest = digest_save;
-	    if (!slow_mode && (c == K_UNSHAR || c == K_PATCH)) {
+	    if (!slow_mode && (c == K_UNSHAR || c == K_PATCH || c == K_MIME)) {
 		tprintf("\r\n\n");
 		any_key(0);
 		goto redraw;