changeset 35301:6cb4bc361bf8

(insert_left_trunc_glyphs): Overwrite padding glyphs by truncation glyphs. (display_line): Optimize for wide characters. (display_string): Don't try to display a multi-column charaters partially. On ttys, produce more than one truncation glyph for multi-column characters that don't fit on the line.
author Kenichi Handa <handa@m17n.org>
date Mon, 15 Jan 2001 04:32:52 +0000
parents 99683b46618e
children 6a51ef53518f
files src/xdisp.c
diffstat 1 files changed, 38 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Mon Jan 15 04:32:25 2001 +0000
+++ b/src/xdisp.c	Mon Jan 15 04:32:52 2001 +0000
@@ -11695,14 +11695,16 @@
   while (from < end)
     *to++ = *from++;
 
-  /* There may be padding glyphs left over.  Remove them.  */
-  from = to;
-  while (from < toend && CHAR_GLYPH_PADDING_P (*from))
-    ++from;
-  while (from < toend)
-    *to++ = *from++;
-
-  it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA];
+  /* There may be padding glyphs left over.  Overwrite them too.  */
+  while (to < toend && CHAR_GLYPH_PADDING_P (*to))
+    {
+      from = truncate_it.glyph_row->glyphs[TEXT_AREA];
+      while (from < end)
+	*to++ = *from++;
+    }
+
+  if (to > toend)
+    it->glyph_row->used[TEXT_AREA] = to - it->glyph_row->glyphs[TEXT_AREA];
 }
 
 
@@ -12188,10 +12190,13 @@
       hpos_before = it->hpos;
       x_before = x;
 	  
-      if (nglyphs == 1
+      if ((nglyphs == 1
+	   /* A wide multibyte character produces multiple glyphs on
+	      tty window  .*/
+	   || !SINGLE_BYTE_CHAR_P (it->c))
 	  && it->current_x < it->last_visible_x)
 	{
-	  ++it->hpos;
+	  it->hpos += nglyphs;
 	  row->ascent = max (row->ascent, it->max_ascent);
 	  row->height = max (row->height, it->max_ascent + it->max_descent);
 	  row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
@@ -13715,8 +13720,17 @@
 	      && x + glyph->pixel_width > max_x)
 	    {
 	      /* End of continued line or max_x reached.  */
-	      it->glyph_row->used[TEXT_AREA] = n_glyphs_before + i;
-	      it->current_x = x;
+	      if (CHAR_GLYPH_PADDING_P (*glyph))
+		{
+		  /* A wide character is unbreakable.  */
+		  it->glyph_row->used[TEXT_AREA] = n_glyphs_before;
+		  it->current_x = x_before;
+		}
+	      else
+		{
+		  it->glyph_row->used[TEXT_AREA] = n_glyphs_before + i;
+		  it->current_x = x;
+		}
 	      break;
 	    }
 	  else if (x + glyph->pixel_width > it->first_visible_x)
@@ -13764,7 +13778,18 @@
 	  if (IT_CHARPOS (*it) < it->string_nchars)
 	    {
 	      if (!FRAME_WINDOW_P (it->f))
-		produce_special_glyphs (it, IT_TRUNCATION);
+		{
+		  int i, n;
+
+		  for (i = row->used[TEXT_AREA] - 1; i > 0; --i)
+		    if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
+		      break;
+		  for (n = row->used[TEXT_AREA]; i < n; ++i)
+		    {
+		      row->used[TEXT_AREA] = i;
+		      produce_special_glyphs (it, IT_TRUNCATION);
+		    }
+		}
 	      it->glyph_row->truncated_on_right_p = 1;
 	    }
 	  break;