changeset 25658:a9f38bb7f815

(read_minibuf_unwind): Call resize_mini_window with new parameter. (read_minibuf): Use prompt_end_charpos instead of minibuffer_prompt_length. (read_minibuf_unwind): Ditto. (Fminibuffer_complete_and_exit): Ditto. (Fminibuffer_complete_word): Ditto. (Fminibuffer_prompt_end): Ditto. (read_minibuf): Return mini-buffer contents without the prompt. (read_minibuf): Set minibuf_prompt_width to the current column after inserting prompt. (Fminibuffer_prompt_width): Return minibuf_prompt_width.
author Gerd Moellmann <gerd@gnu.org>
date Sun, 12 Sep 1999 20:21:55 +0000
parents 2e9b26a83bfa
children fe4146e7baf9
files src/minibuf.c
diffstat 1 files changed, 17 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/minibuf.c	Sun Sep 12 20:21:53 1999 +0000
+++ b/src/minibuf.c	Sun Sep 12 20:21:55 1999 +0000
@@ -312,7 +312,7 @@
 					 Fcons (Vminibuffer_history_variable,
 						minibuf_save_list))))));
   minibuf_save_list
-    = Fcons (current_buffer->minibuffer_prompt_length,
+    = Fcons (current_buffer->prompt_end_charpos,
 	     minibuf_save_list);
 
   record_unwind_protect (read_minibuf_unwind, Qnil);
@@ -320,7 +320,7 @@
 
   /* Now that we can restore all those variables, start changing them.  */
 
-  minibuf_prompt_width = 0;	/* xdisp.c puts in the right value.  */
+  minibuf_prompt_width = 0;
   minibuf_prompt = Fcopy_sequence (prompt);
   Vminibuffer_history_position = histpos;
   Vminibuffer_history_variable = histvar;
@@ -378,7 +378,7 @@
 
   Fmake_local_variable (Qprint_escape_newlines);
   print_escape_newlines = 1;
-  XSETFASTINT (current_buffer->minibuffer_prompt_length, 0);
+  XSETFASTINT (current_buffer->prompt_end_charpos, 0);
 
   /* Erase the buffer.  */
   {
@@ -394,7 +394,7 @@
 
   /* Insert the prompt, record where it ends.  */
   Finsert (1, &minibuf_prompt);
-  XSETFASTINT (current_buffer->minibuffer_prompt_length, PT);
+  XSETFASTINT (current_buffer->prompt_end_charpos, PT);
   if (PT > BEG)
     {
       Fput_text_property (make_number (BEG), make_number (PT),
@@ -404,6 +404,8 @@
       Fput_text_property (make_number (BEG), make_number (PT),
 			  Qread_only, Qt, Qnil);
     }
+  
+  minibuf_prompt_width = current_column ();
       
   /* If appropriate, copy enable-multibyte-characters into the minibuffer.  */
   if (inherit_input_method)
@@ -448,7 +450,8 @@
 
   /* Make minibuffer contents into a string.  */
   Fset_buffer (minibuffer);
-  val = make_buffer_string (1, Z, allow_props);
+  val = make_buffer_string (current_buffer->prompt_end_charpos,
+			    Z, allow_props);
 
   /* VAL is the string of minibuffer text.  */
 
@@ -601,7 +604,7 @@
   Fset_buffer (XWINDOW (window)->buffer);
 
   /* Restore prompt, etc, from outer minibuffer level.  */
-  current_buffer->minibuffer_prompt_length = Fcar (minibuf_save_list);
+  current_buffer->prompt_end_charpos = Fcar (minibuf_save_list);
   minibuf_save_list = Fcdr (minibuf_save_list);
 
   minibuf_prompt = Fcar (minibuf_save_list);
@@ -639,7 +642,7 @@
   /* When we get to the outmost level, make sure we resize the
      mini-window back to its normal size.  */
   if (minibuf_level == 0)
-    resize_mini_window (XWINDOW (window));
+    resize_mini_window (XWINDOW (window), 0);
 
   /* Make sure minibuffer window is erased, not ignored.  */
   windows_or_buffers_changed++;
@@ -1653,7 +1656,7 @@
   Lisp_Object val;
 
   /* Allow user to specify null string */
-  if (XFASTINT (current_buffer->minibuffer_prompt_length) == ZV)
+  if (XFASTINT (current_buffer->prompt_end_charpos) == ZV)
     goto exit;
 
   if (!NILP (test_completion (Fbuffer_string ())))
@@ -1790,7 +1793,7 @@
   
   {
     int prompt_end_charpos, prompt_end_bytepos;
-    prompt_end_charpos = XFASTINT (current_buffer->minibuffer_prompt_length);
+    prompt_end_charpos = XFASTINT (current_buffer->prompt_end_charpos);
     prompt_end_bytepos = CHAR_TO_BYTE (prompt_end_charpos);
     i = ZV - prompt_end_charpos;
     i_byte = ZV_BYTE - prompt_end_bytepos;
@@ -1844,7 +1847,7 @@
 
   /* If got no characters, print help for user.  */
 
-  if (i == ZV - XFASTINT (current_buffer->minibuffer_prompt_length))
+  if (i == ZV - XFASTINT (current_buffer->prompt_end_charpos))
     {
       if (auto_help)
 	Fminibuffer_completion_help ();
@@ -2101,16 +2104,10 @@
 
 DEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width,
   Sminibuffer_prompt_width, 0, 0, 0,
-  "Return the display width of the minibuffer prompt.\n\
-Return 0 if current buffer is not a mini-buffer.")
+  "Return the display width of the minibuffer prompt.")
   ()
 {
-  Lisp_Object width;
-  if (NILP (current_buffer->minibuffer_prompt_length))
-    width = make_number (0);
-  else
-    width = make_number (current_buffer->minibuffer_prompt_length);
-  return width;
+  return make_number (minibuf_prompt_width);
 }
 
 
@@ -2120,9 +2117,9 @@
 Value is 0 if current buffer is not a mini-buffer.")
      ()
 {
-  return (NILP (current_buffer->minibuffer_prompt_length)
+  return (NILP (current_buffer->prompt_end_charpos)
 	  ? make_number (0)
-	  : make_number (current_buffer->minibuffer_prompt_length));
+	  : make_number (current_buffer->prompt_end_charpos));
 }