diff src/redisplay-tty.c @ 3571:f6cd5fe9bf4c

[xemacs-hg @ 2006-08-24 21:21:34 by aidan] Vary support for multiple-width characters on a per-console basis.
author aidan
date Thu, 24 Aug 2006 21:21:36 +0000
parents 2b84dd8eb906
children ea701c23ed84
line wrap: on
line diff
--- a/src/redisplay-tty.c	Wed Aug 23 21:51:03 2006 +0000
+++ b/src/redisplay-tty.c	Thu Aug 24 21:21:36 2006 +0000
@@ -100,16 +100,23 @@
 /*****************************************************************************
  tty_text_width
 
- Non-Mule tty's don't have fonts (that we use at least), so everything
+ Non-Mule TTYs don't have fonts (that we use at least), so everything
  is considered to be fixed width -- in other words, we return LEN.
  Under Mule, however, a character can still cover more than one
  column, so we use ichar_string_displayed_columns().
  ****************************************************************************/
 static int
-tty_text_width (struct frame *UNUSED (f), struct face_cachel *UNUSED (cachel),
+tty_text_width (struct frame *f, struct face_cachel *UNUSED (cachel),
 		const Ichar *str, Charcount len)
 {
-  return ichar_string_displayed_columns (str, len);
+  struct console *c = XCONSOLE(FRAME_CONSOLE (f));
+
+  if (CONSOLE_TTY_MULTIPLE_WIDTH (c))
+    {
+      return ichar_string_displayed_columns (str, len);
+    }
+
+  return len;
 }
 
 /*****************************************************************************
@@ -533,6 +540,9 @@
 {
   struct frame *f = XFRAME (w->frame);
   struct console *c = XCONSOLE (FRAME_CONSOLE (f));
+  int incing = CONSOLE_TTY_MULTIPLE_WIDTH (c) ? 
+    ibyte_string_displayed_columns (str, len) : 
+    bytecount_to_charcount(str, len);
 
   /* First position the cursor. */
   cmgoto (f, dl->ypos - 1, xpos);
@@ -541,7 +551,7 @@
   tty_turn_on_face (w, findex);
 
   send_string_to_tty_console (c, str, len);
-  TTY_INC_CURSOR_X (c, ibyte_string_displayed_columns (str, len));
+  TTY_INC_CURSOR_X (c, incing);
 
   /* Turn the face properties back off. */
   tty_turn_off_face (w, findex);