changeset 27409:4df4f3866b55

(IT_menu_display): Truncate long menu lines at the right screen boundary.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 24 Jan 2000 14:41:27 +0000
parents 155a79b2cb98
children d6b965f1499c
files src/msdos.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/msdos.c	Sun Jan 23 22:20:24 2000 +0000
+++ b/src/msdos.c	Mon Jan 24 14:41:27 2000 +0000
@@ -3268,6 +3268,8 @@
   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 @@
 	      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);