diff options
| author | Gerd Moellmann | 1999-09-12 20:21:55 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-09-12 20:21:55 +0000 |
| commit | 1e3f16d5eba3a6a4f99ae2c448e8108b5d9390ed (patch) | |
| tree | 5192d680a1802188b21fa1fd6c816d87b665500b /src | |
| parent | 8f12e41de71c95542ac8167919e92cd6da244a06 (diff) | |
| download | emacs-1e3f16d5eba3a6a4f99ae2c448e8108b5d9390ed.tar.gz emacs-1e3f16d5eba3a6a4f99ae2c448e8108b5d9390ed.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index b056c379d8b..99b16c19420 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -312,7 +312,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 312 | Fcons (Vminibuffer_history_variable, | 312 | Fcons (Vminibuffer_history_variable, |
| 313 | minibuf_save_list)))))); | 313 | minibuf_save_list)))))); |
| 314 | minibuf_save_list | 314 | minibuf_save_list |
| 315 | = Fcons (current_buffer->minibuffer_prompt_length, | 315 | = Fcons (current_buffer->prompt_end_charpos, |
| 316 | minibuf_save_list); | 316 | minibuf_save_list); |
| 317 | 317 | ||
| 318 | record_unwind_protect (read_minibuf_unwind, Qnil); | 318 | record_unwind_protect (read_minibuf_unwind, Qnil); |
| @@ -320,7 +320,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 320 | 320 | ||
| 321 | /* Now that we can restore all those variables, start changing them. */ | 321 | /* Now that we can restore all those variables, start changing them. */ |
| 322 | 322 | ||
| 323 | minibuf_prompt_width = 0; /* xdisp.c puts in the right value. */ | 323 | minibuf_prompt_width = 0; |
| 324 | minibuf_prompt = Fcopy_sequence (prompt); | 324 | minibuf_prompt = Fcopy_sequence (prompt); |
| 325 | Vminibuffer_history_position = histpos; | 325 | Vminibuffer_history_position = histpos; |
| 326 | Vminibuffer_history_variable = histvar; | 326 | Vminibuffer_history_variable = histvar; |
| @@ -378,7 +378,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 378 | 378 | ||
| 379 | Fmake_local_variable (Qprint_escape_newlines); | 379 | Fmake_local_variable (Qprint_escape_newlines); |
| 380 | print_escape_newlines = 1; | 380 | print_escape_newlines = 1; |
| 381 | XSETFASTINT (current_buffer->minibuffer_prompt_length, 0); | 381 | XSETFASTINT (current_buffer->prompt_end_charpos, 0); |
| 382 | 382 | ||
| 383 | /* Erase the buffer. */ | 383 | /* Erase the buffer. */ |
| 384 | { | 384 | { |
| @@ -394,7 +394,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 394 | 394 | ||
| 395 | /* Insert the prompt, record where it ends. */ | 395 | /* Insert the prompt, record where it ends. */ |
| 396 | Finsert (1, &minibuf_prompt); | 396 | Finsert (1, &minibuf_prompt); |
| 397 | XSETFASTINT (current_buffer->minibuffer_prompt_length, PT); | 397 | XSETFASTINT (current_buffer->prompt_end_charpos, PT); |
| 398 | if (PT > BEG) | 398 | if (PT > BEG) |
| 399 | { | 399 | { |
| 400 | Fput_text_property (make_number (BEG), make_number (PT), | 400 | Fput_text_property (make_number (BEG), make_number (PT), |
| @@ -404,6 +404,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 404 | Fput_text_property (make_number (BEG), make_number (PT), | 404 | Fput_text_property (make_number (BEG), make_number (PT), |
| 405 | Qread_only, Qt, Qnil); | 405 | Qread_only, Qt, Qnil); |
| 406 | } | 406 | } |
| 407 | |||
| 408 | minibuf_prompt_width = current_column (); | ||
| 407 | 409 | ||
| 408 | /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ | 410 | /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ |
| 409 | if (inherit_input_method) | 411 | if (inherit_input_method) |
| @@ -448,7 +450,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 448 | 450 | ||
| 449 | /* Make minibuffer contents into a string. */ | 451 | /* Make minibuffer contents into a string. */ |
| 450 | Fset_buffer (minibuffer); | 452 | Fset_buffer (minibuffer); |
| 451 | val = make_buffer_string (1, Z, allow_props); | 453 | val = make_buffer_string (current_buffer->prompt_end_charpos, |
| 454 | Z, allow_props); | ||
| 452 | 455 | ||
| 453 | /* VAL is the string of minibuffer text. */ | 456 | /* VAL is the string of minibuffer text. */ |
| 454 | 457 | ||
| @@ -601,7 +604,7 @@ read_minibuf_unwind (data) | |||
| 601 | Fset_buffer (XWINDOW (window)->buffer); | 604 | Fset_buffer (XWINDOW (window)->buffer); |
| 602 | 605 | ||
| 603 | /* Restore prompt, etc, from outer minibuffer level. */ | 606 | /* Restore prompt, etc, from outer minibuffer level. */ |
| 604 | current_buffer->minibuffer_prompt_length = Fcar (minibuf_save_list); | 607 | current_buffer->prompt_end_charpos = Fcar (minibuf_save_list); |
| 605 | minibuf_save_list = Fcdr (minibuf_save_list); | 608 | minibuf_save_list = Fcdr (minibuf_save_list); |
| 606 | 609 | ||
| 607 | minibuf_prompt = Fcar (minibuf_save_list); | 610 | minibuf_prompt = Fcar (minibuf_save_list); |
| @@ -639,7 +642,7 @@ read_minibuf_unwind (data) | |||
| 639 | /* When we get to the outmost level, make sure we resize the | 642 | /* When we get to the outmost level, make sure we resize the |
| 640 | mini-window back to its normal size. */ | 643 | mini-window back to its normal size. */ |
| 641 | if (minibuf_level == 0) | 644 | if (minibuf_level == 0) |
| 642 | resize_mini_window (XWINDOW (window)); | 645 | resize_mini_window (XWINDOW (window), 0); |
| 643 | 646 | ||
| 644 | /* Make sure minibuffer window is erased, not ignored. */ | 647 | /* Make sure minibuffer window is erased, not ignored. */ |
| 645 | windows_or_buffers_changed++; | 648 | windows_or_buffers_changed++; |
| @@ -1653,7 +1656,7 @@ a repetition of this command will exit.") | |||
| 1653 | Lisp_Object val; | 1656 | Lisp_Object val; |
| 1654 | 1657 | ||
| 1655 | /* Allow user to specify null string */ | 1658 | /* Allow user to specify null string */ |
| 1656 | if (XFASTINT (current_buffer->minibuffer_prompt_length) == ZV) | 1659 | if (XFASTINT (current_buffer->prompt_end_charpos) == ZV) |
| 1657 | goto exit; | 1660 | goto exit; |
| 1658 | 1661 | ||
| 1659 | if (!NILP (test_completion (Fbuffer_string ()))) | 1662 | if (!NILP (test_completion (Fbuffer_string ()))) |
| @@ -1790,7 +1793,7 @@ Return nil if there is no valid completion, else t.") | |||
| 1790 | 1793 | ||
| 1791 | { | 1794 | { |
| 1792 | int prompt_end_charpos, prompt_end_bytepos; | 1795 | int prompt_end_charpos, prompt_end_bytepos; |
| 1793 | prompt_end_charpos = XFASTINT (current_buffer->minibuffer_prompt_length); | 1796 | prompt_end_charpos = XFASTINT (current_buffer->prompt_end_charpos); |
| 1794 | prompt_end_bytepos = CHAR_TO_BYTE (prompt_end_charpos); | 1797 | prompt_end_bytepos = CHAR_TO_BYTE (prompt_end_charpos); |
| 1795 | i = ZV - prompt_end_charpos; | 1798 | i = ZV - prompt_end_charpos; |
| 1796 | i_byte = ZV_BYTE - prompt_end_bytepos; | 1799 | i_byte = ZV_BYTE - prompt_end_bytepos; |
| @@ -1844,7 +1847,7 @@ Return nil if there is no valid completion, else t.") | |||
| 1844 | 1847 | ||
| 1845 | /* If got no characters, print help for user. */ | 1848 | /* If got no characters, print help for user. */ |
| 1846 | 1849 | ||
| 1847 | if (i == ZV - XFASTINT (current_buffer->minibuffer_prompt_length)) | 1850 | if (i == ZV - XFASTINT (current_buffer->prompt_end_charpos)) |
| 1848 | { | 1851 | { |
| 1849 | if (auto_help) | 1852 | if (auto_help) |
| 1850 | Fminibuffer_completion_help (); | 1853 | Fminibuffer_completion_help (); |
| @@ -2101,16 +2104,10 @@ If no minibuffer is active, return nil.") | |||
| 2101 | 2104 | ||
| 2102 | DEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width, | 2105 | DEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width, |
| 2103 | Sminibuffer_prompt_width, 0, 0, 0, | 2106 | Sminibuffer_prompt_width, 0, 0, 0, |
| 2104 | "Return the display width of the minibuffer prompt.\n\ | 2107 | "Return the display width of the minibuffer prompt.") |
| 2105 | Return 0 if current buffer is not a mini-buffer.") | ||
| 2106 | () | 2108 | () |
| 2107 | { | 2109 | { |
| 2108 | Lisp_Object width; | 2110 | return make_number (minibuf_prompt_width); |
| 2109 | if (NILP (current_buffer->minibuffer_prompt_length)) | ||
| 2110 | width = make_number (0); | ||
| 2111 | else | ||
| 2112 | width = make_number (current_buffer->minibuffer_prompt_length); | ||
| 2113 | return width; | ||
| 2114 | } | 2111 | } |
| 2115 | 2112 | ||
| 2116 | 2113 | ||
| @@ -2120,9 +2117,9 @@ DEFUN ("minibuffer-prompt-end", Fminibuffer_prompt_end, | |||
| 2120 | Value is 0 if current buffer is not a mini-buffer.") | 2117 | Value is 0 if current buffer is not a mini-buffer.") |
| 2121 | () | 2118 | () |
| 2122 | { | 2119 | { |
| 2123 | return (NILP (current_buffer->minibuffer_prompt_length) | 2120 | return (NILP (current_buffer->prompt_end_charpos) |
| 2124 | ? make_number (0) | 2121 | ? make_number (0) |
| 2125 | : make_number (current_buffer->minibuffer_prompt_length)); | 2122 | : make_number (current_buffer->prompt_end_charpos)); |
| 2126 | } | 2123 | } |
| 2127 | 2124 | ||
| 2128 | 2125 | ||