From: Eli Zaretskii Date: Mon, 24 Jan 2000 14:44:26 +0000 (+0000) Subject: (IT_menu_display): Truncate long menu lines at the right X-Git-Tag: emacs-pretest-21.0.90~5277 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=edf6aeb8901106f4a038a4c23b7cbe0fae853c93;p=emacs.git (IT_menu_display): Truncate long menu lines at the right screen boundary. --- diff --git a/src/ChangeLog b/src/ChangeLog index 6f52fa04804..e72c2250ea0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2000-01-24 Eli Zaretskii + + * msdos.c (IT_menu_display): Truncate long menu lines at the right + screen boundary. + 2000-01-23 Jason Rumney * w32fns.c (w32_defined_color): Apply gamma correction before diff --git a/src/msdos.c b/src/msdos.c index 3cd0d7e5a4e..fc1509b6010 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -3268,6 +3268,8 @@ IT_menu_display (XMenu *menu, int y, int x, int *faces) IT_update_begin (sf); for (i = 0; i < menu->count; i++) { + int max_width = width + 2; + IT_cursor_to (y + i, x); enabled = (!menu->submenu[i] && menu->panenumber[i]) || (menu->submenu[i]); @@ -3292,13 +3294,18 @@ IT_menu_display (XMenu *menu, int y, int x, int *faces) p++; } } - - for (; j < width; j++, p++) + /* Don't let the menu text overflow into the next screen row. */ + if (x + max_width > screen_size_X) + { + max_width = screen_size_X - x; + text[max_width - 1].u.ch = '$'; /* indicate it's truncated */ + } + for (; j < max_width - 2; j++, p++) SET_CHAR_GLYPH (*p, ' ', face, 0); SET_CHAR_GLYPH (*p, menu->submenu[i] ? 16 : ' ', face, 0); p++; - IT_write_glyphs (text, width + 2); + IT_write_glyphs (text, max_width); } IT_update_end (sf); IT_cursor_to (row, col);