From: Eli Zaretskii Date: Fri, 11 Oct 2013 15:42:06 +0000 (+0300) Subject: Support frame dimension changes while TTY menus are displayed. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1284^2~17 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=abe020201356dca6792d48add69029658b1df0b0;p=emacs.git Support frame dimension changes while TTY menus are displayed. src/xdisp.c (deep_copy_glyph_row): Handle the case that FROM and TO have different dimensions. src/dispnew.c (fill_up_frame_row_with_spaces): Now has external visibility. src/dispextern.h (fill_up_frame_row_with_spaces): Add prototype. Fixes: debbugs:15575 --- diff --git a/src/ChangeLog b/src/ChangeLog index 42650a31c7a..faf6724b7df 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2013-10-11 Eli Zaretskii + + * xdisp.c (deep_copy_glyph_row): Handle the case that FROM and TO + have different dimensions. (Bug#15575) + + * dispnew.c (fill_up_frame_row_with_spaces): Now has external + visibility. + + * dispextern.h (fill_up_frame_row_with_spaces): Add prototype. + 2013-10-11 Dmitry Antipov * term.c (tty_menu_show): Never return with unbalanced diff --git a/src/dispextern.h b/src/dispextern.h index 10cd3169408..2d09fe7c5fe 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3472,6 +3472,7 @@ void init_display (void); void syms_of_display (void); extern Lisp_Object Qredisplay_dont_pause; extern void spec_glyph_lookup_face (struct window *, GLYPH *); +extern void fill_up_frame_row_with_spaces (struct glyph_row *, int); /* Defined in terminal.c */ diff --git a/src/dispnew.c b/src/dispnew.c index d01de185332..3c0fda0b745 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -77,7 +77,6 @@ static int required_matrix_height (struct window *); static int required_matrix_width (struct window *); static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool); static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t); -static void fill_up_frame_row_with_spaces (struct glyph_row *, int); static void build_frame_matrix_from_window_tree (struct glyph_matrix *, struct window *); static void build_frame_matrix_from_leaf_window (struct glyph_matrix *, @@ -2503,7 +2502,7 @@ fill_up_glyph_row_area_with_spaces (struct glyph_row *row, int area) /* Add spaces to the end of ROW in a frame matrix until index UPTO is reached. In frame matrices only one area, TEXT_AREA, is used. */ -static void +void fill_up_frame_row_with_spaces (struct glyph_row *row, int upto) { int i = row->used[TEXT_AREA]; diff --git a/src/xdisp.c b/src/xdisp.c index 7cfb0ab51ad..033d3b47147 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20590,10 +20590,10 @@ static void deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from) { struct glyph *pointers[1 + LAST_AREA]; + int to_used = to->used[TEXT_AREA]; /* Save glyph pointers of TO. */ memcpy (pointers, to->glyphs, sizeof to->glyphs); - eassert (to->used[TEXT_AREA] == from->used[TEXT_AREA]); /* Do a structure assignment. */ *to = *from; @@ -20603,7 +20603,12 @@ deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from) /* Copy the glyphs. */ memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], - from->used[TEXT_AREA] * sizeof (struct glyph)); + min (from->used[TEXT_AREA], to_used) * sizeof (struct glyph)); + + /* If we filled only part of the TO row, fill the rest with + space_glyph (which will display as empty space). */ + if (to_used > from->used[TEXT_AREA]) + fill_up_frame_row_with_spaces (to, to_used); } /* Display one menu item on a TTY, by overwriting the glyphs in the