(IT_menu_display): Truncate long menu lines at the right

screen boundary.
This commit is contained in:
Eli Zaretskii 2000-01-24 14:44:26 +00:00
parent 9badad414d
commit edf6aeb890
2 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2000-01-24 Eli Zaretskii <eliz@is.elta.co.il>
* msdos.c (IT_menu_display): Truncate long menu lines at the right
screen boundary.
2000-01-23 Jason Rumney <jasonr@gnu.org>
* w32fns.c (w32_defined_color): Apply gamma correction before

View file

@ -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);