]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
Readline-5.1.004 import
authorChet Ramey <chet.ramey@case.edu>
Thu, 24 Nov 2011 00:16:11 +0000 (19:16 -0500)
committerChet Ramey <chet.ramey@case.edu>
Thu, 24 Nov 2011 00:16:11 +0000 (19:16 -0500)
display.c
readline.c
text.c

index b22521bfc44e03501ee2e80e630761842aa1c4ac..0d3ae6e5da9034b3ad58578ff5fb22952cd7acc1 100644 (file)
--- a/display.c
+++ b/display.c
@@ -1983,11 +1983,15 @@ _rl_make_prompt_for_search (pchar)
      int pchar;
 {
   int len;
-  char *pmt;
+  char *pmt, *p;
 
   rl_save_prompt ();
 
-  if (saved_local_prompt == 0)
+  /* We've saved the prompt, and can do anything with the various prompt
+     strings we need before they're restored.  We want the unexpanded
+     portion of the prompt string after any final newline. */
+  p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
+  if (p == 0)
     {
       len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
       pmt = (char *)xmalloc (len + 2);
@@ -1998,19 +2002,17 @@ _rl_make_prompt_for_search (pchar)
     }
   else
     {
-      len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
+      p++;
+      len = strlen (p);
       pmt = (char *)xmalloc (len + 2);
       if (len)
-       strcpy (pmt, saved_local_prompt);
+       strcpy (pmt, p);
       pmt[len] = pchar;
       pmt[len+1] = '\0';
-      local_prompt = savestring (pmt);
-      prompt_last_invisible = saved_last_invisible;
-      prompt_visible_length = saved_visible_length + 1;
-    }
+    }  
 
+  /* will be overwritten by expand_prompt, called from rl_message */
   prompt_physical_chars = saved_physical_chars + 1;
-
   return pmt;
 }
 
index 5e9767ab47f9fbbf7e25a56d82c757f6aeacc304..5eaaf47435e6b87c20f21150a753c0f8f2724f69 100644 (file)
@@ -282,6 +282,7 @@ rl_set_prompt (prompt)
 {
   FREE (rl_prompt);
   rl_prompt = prompt ? savestring (prompt) : (char *)NULL;
+  rl_display_prompt = rl_prompt ? rl_prompt : "";
 
   rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
   return 0;
@@ -714,7 +715,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
 
          rl_dispatching = 1;
          RL_SETSTATE(RL_STATE_DISPATCHING);
-         r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
+         (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
          RL_UNSETSTATE(RL_STATE_DISPATCHING);
          rl_dispatching = 0;
 
diff --git a/text.c b/text.c
index 9053e96903bb1c7bb78323a42c80a35061042a14..bb87604aa6d4b286d9cc67de8503b5277963d3ec 100644 (file)
--- a/text.c
+++ b/text.c
@@ -1071,8 +1071,6 @@ int
 rl_delete (count, key)
      int count, key;
 {
-  int r;
-
   if (count < 0)
     return (_rl_rubout_char (-count, key));
 
@@ -1090,17 +1088,17 @@ rl_delete (count, key)
       else
        rl_forward_byte (count, key);
 
-      r = rl_kill_text (orig_point, rl_point);
+      rl_kill_text (orig_point, rl_point);
       rl_point = orig_point;
-      return r;
     }
   else
     {
       int new_point;
 
       new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
-      return (rl_delete_text (rl_point, new_point));
+      rl_delete_text (rl_point, new_point);
     }
+  return 0;
 }
 
 /* Delete the character under the cursor, unless the insertion