summaryrefslogtreecommitdiff
path: root/news/tin/patches/patch-aj
diff options
context:
space:
mode:
Diffstat (limited to 'news/tin/patches/patch-aj')
-rw-r--r--news/tin/patches/patch-aj110
1 files changed, 110 insertions, 0 deletions
diff --git a/news/tin/patches/patch-aj b/news/tin/patches/patch-aj
new file mode 100644
index 00000000000..d1df7c1f793
--- /dev/null
+++ b/news/tin/patches/patch-aj
@@ -0,0 +1,110 @@
+$NetBSD: patch-aj,v 1.1 2009/10/22 22:01:26 wiz Exp $
+
+--- src/prompt.c.orig 2009-01-23 16:10:39.000000000 +0100
++++ src/prompt.c
+@@ -44,6 +44,7 @@
+
+
+ static char *prompt_slk_message; /* prompt message for prompt_slk_redraw */
++static char *prompt_yn_message;
+
+ /*
+ * Local prototypes
+@@ -163,7 +164,7 @@ prompt_yn(
+ {
+ char *keyprompt;
+ char keyno[MAXKEYLEN], keyyes[MAXKEYLEN];
+- int keyyes_len = 0, keyno_len = 0, maxlen;
++ int keyyes_len = 0, keyno_len = 0, maxlen, prompt_len;
+ t_function func;
+ #if defined (MULTIBYTE_ABLE) && !defined(NO_LOCALE)
+ wint_t yes, no, prompt_ch, ch;
+@@ -194,21 +195,17 @@ prompt_yn(
+ keyno_len = (int) strlen(keyno);
+ #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
+ maxlen = MAX(keyyes_len, keyno_len);
++ prompt_len = (int) strlen(prompt) + keyyes_len + keyno_len + maxlen + 6;
++ prompt_yn_message = my_malloc(prompt_len + 1);
++
++ input_context = cPromptYN;
+
+ do {
+ prompt_ch = (default_answer ? yes : no);
+ keyprompt = (default_answer ? keyyes : keyno);
+
+- if (!cmd_line) {
+- MoveCursor(cLINES, 0);
+- CleartoEOLN();
+- }
+- my_printf("%s (%s/%s) %-*s", prompt, keyyes, keyno, maxlen, keyprompt);
+- if (!cmd_line)
+- cursoron();
+- my_flush();
+- if (!cmd_line)
+- MoveCursor(cLINES, (int) strlen(prompt) + keyyes_len + keyno_len + 5);
++ snprintf(prompt_yn_message, prompt_len, "%s (%s/%s) %-*s", prompt, keyyes, keyno, maxlen, keyprompt);
++ prompt_yn_redraw();
+
+ #if defined (MULTIBYTE_ABLE) && !defined(NO_LOCALE)
+ if (((ch = ReadWch()) == '\n') || (ch == '\r'))
+@@ -248,6 +245,9 @@ prompt_yn(
+ func = key_to_func(ch, prompt_keys);
+ } while (func == NOT_ASSIGNED);
+
++ input_context = cNone;
++ FreeAndNull(prompt_yn_message);
++
+ if (!cmd_line) {
+ clear_message();
+ my_flush();
+@@ -256,6 +256,24 @@ prompt_yn(
+ }
+
+
++/* (Re)draws the prompt message for prompt_yn() */
++void
++prompt_yn_redraw(
++ void)
++{
++ if (!cmd_line) {
++ MoveCursor(cLINES, 0);
++ CleartoEOLN();
++ }
++ my_printf("%s", prompt_yn_message);
++ if (!cmd_line)
++ cursoron();
++ my_flush();
++ if (!cmd_line)
++ MoveCursor(cLINES, (int) strlen(prompt_yn_message) -1);
++}
++
++
+ /*
+ * help_text is displayed near the bottom of the screen.
+ * var is an index into a list containing size elements.
+@@ -745,11 +763,14 @@ prompt_continue(
+ void)
+ {
+ int ch;
++ int save_signal_context = signal_context;
+
+ #ifdef USE_CURSES
+ cmd_line = TRUE;
+ #endif /* USE_CURSES */
+ info_message(_(txt_return_key));
++ signal_context = cMain;
++ input_context = cPromptCONT;
+
+ switch ((ch = ReadCh())) {
+ case ESC:
+@@ -763,6 +784,10 @@ prompt_continue(
+ break;
+ }
+
++ input_context = cNone;
++ signal_context = save_signal_context;
++ my_fputc('\n', stdout);
++
+ #ifdef USE_CURSES
+ cmd_line = FALSE;
+ my_retouch();