From 648fa17da60726950f3b318c4d55643ed44d54c8 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sat, 29 Aug 1992 02:55:05 +0000 Subject: * dispnew.c: Incude "systty.h", not "systerm.h". * dispnew.c (update_frame): Change the way we handle cursor_in_echo_area. Firstly, ignore this if the frame we're updating doesn't have a minibuffer. Secondly, don't handle the selected frame specially. Thirdly, don't assume that the minibuffer is only one line high. If cursor_in_echo_area < 0, put the cursor in the upper-left corner; if cursor_in_echo_area > 0, put it on the lowest non-empty line in the minibuffer window, or on the top line. * dispnew.c (direct_output_for_insert): Fail if cursor_in_echo_area is set; we don't want to do the typing there. (direct_output_for_insert): Same. --- src/dispnew.c | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) (limited to 'src/dispnew.c') diff --git a/src/dispnew.c b/src/dispnew.c index ea1f64434a..9bfeb0505c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -36,7 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "disptab.h" #include "indent.h" -#include "systerm.h" +#include "systty.h" #include "systime.h" #ifdef HAVE_X_WINDOWS @@ -874,6 +874,7 @@ direct_output_for_insert (g) || (XINT (w->hscroll) && hpos == XFASTINT (w->left)) /* Give up if cursor outside window (in minibuf, probably) */ + || cursor_in_echo_area || FRAME_CURSOR_Y (frame) < XFASTINT (w->top) || FRAME_CURSOR_Y (frame) >= XFASTINT (w->top) + XFASTINT (w->height) @@ -922,7 +923,8 @@ direct_output_forward_char (n) && (FRAME_CURSOR_X (frame) + 1 >= (XFASTINT (w->left) + XFASTINT (w->width) - (XFASTINT (w->width) < FRAME_WIDTH (frame)) - - 1)))) + - 1))) + || cursor_in_echo_area) return 0; FRAME_CURSOR_X (frame) += n; @@ -1052,18 +1054,41 @@ update_frame (f, force, inhibit_hairy_id) /* Now just clean up termcap drivers and set cursor, etc. */ if (!pause) { - if (cursor_in_echo_area) + if (cursor_in_echo_area + && FRAME_HAS_MINIBUF_P (f)) { - if (f == selected_frame - && cursor_in_echo_area < 0) - cursor_to (FRAME_HEIGHT (f) - 1, 0); - else if (f == selected_frame - && ! current_frame->enable[FRAME_HEIGHT (f) - 1]) - cursor_to (FRAME_HEIGHT (f) - 1, 0); + int top = XINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top); + int row, col; + + if (cursor_in_echo_area < 0) + { + row = top; + col = 0; + } else - cursor_to (FRAME_HEIGHT (f) - 1, - min (FRAME_WIDTH (f) - 1, - current_frame->used[FRAME_HEIGHT (f) - 1])); + { + /* If the minibuffer is several lines high, find the last + line that has any text on it. */ + row = FRAME_HEIGHT (f); + do + { + row--; + if (current_frame->enable[row]) + col = current_frame->used[row]; + else + col = 0; + } + while (row > top && col == 0); + + if (col >= FRAME_WIDTH (f)) + { + col = 0; + if (row < FRAME_HEIGHT (f) - 1) + row++; + } + } + + cursor_to (row, col); } else cursor_to (FRAME_CURSOR_Y (f), max (min (FRAME_CURSOR_X (f), -- cgit v1.2.3