emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114659: * termhooks.h (FRAME_MUST_WRITE_SPACES, FRA


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114659: * termhooks.h (FRAME_MUST_WRITE_SPACES, FRAME_LINE_INS_DEL_OK)
Date: Mon, 14 Oct 2013 12:20:09 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114659
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Mon 2013-10-14 16:19:21 +0400
message:
  * termhooks.h (FRAME_MUST_WRITE_SPACES, FRAME_LINE_INS_DEL_OK)
  (FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK)
  (FRAME_SCROLL_REGION_COST, FRAME_MEMORY_BELOW_FRAME):
  Adjust to match the change described below.
  (struct terminal): Move must_write_spaces, line_ins_del_ok,
  char_ins_del_ok, scroll_region_ok, scroll_region_cost and
  memory_below_frame members to...
  * termchar.h (struct tty_display_info): ...here because they're
  relevant only on TTYs.  Prefer unsigned bitfield where appropriate.
  * term.c (init_tty):
  * nsterm.m (ns_create_terminal):
  * w32term.c (w32_create_terminal):
  * xterm.c (x_create_terminal): Adjust users.
  * dispnew.c (line_hash_code, line_draw_cost): Pass frame arg
  to filter out non-TTY frames.  Adjust comment.
  (scrolling): Adjust user.  Prefer eassert for debugging check.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/dispnew.c                  dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
  src/nsterm.m                   nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
  src/term.c                     term.c-20091113204419-o5vbwnq5f7feedwu-220
  src/termchar.h                 termchar.h-20091113204419-o5vbwnq5f7feedwu-440
  src/termhooks.h                termhooks.h-20091113204419-o5vbwnq5f7feedwu-249
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-14 10:55:24 +0000
+++ b/src/ChangeLog     2013-10-14 12:19:21 +0000
@@ -1,5 +1,24 @@
 2013-10-14  Dmitry Antipov  <address@hidden>
 
+       * termhooks.h (FRAME_MUST_WRITE_SPACES, FRAME_LINE_INS_DEL_OK)
+       (FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK)
+       (FRAME_SCROLL_REGION_COST, FRAME_MEMORY_BELOW_FRAME):
+       Adjust to match the change described below.
+       (struct terminal): Move must_write_spaces, line_ins_del_ok,
+       char_ins_del_ok, scroll_region_ok, scroll_region_cost and
+       memory_below_frame members to...
+       * termchar.h (struct tty_display_info): ...here because they're
+       relevant only on TTYs.  Prefer unsigned bitfield where appropriate.
+       * term.c (init_tty):
+       * nsterm.m (ns_create_terminal):
+       * w32term.c (w32_create_terminal):
+       * xterm.c (x_create_terminal): Adjust users.
+       * dispnew.c (line_hash_code, line_draw_cost): Pass frame arg
+       to filter out non-TTY frames.  Adjust comment.
+       (scrolling): Adjust user.  Prefer eassert for debugging check.
+
+2013-10-14  Dmitry Antipov  <address@hidden>
+
        * xfaces.c (PT_PER_INCH): Remove unused macro.
        * termhooks.h (struct terminal): Remove set-but-unused
        member fast_clear_end_of_line.

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2013-10-11 15:42:06 +0000
+++ b/src/dispnew.c     2013-10-14 12:19:21 +0000
@@ -1070,10 +1070,11 @@
 }
 
 
-/* Return a hash code for glyph row ROW.  */
+/* Return a hash code for glyph row ROW, which may
+   be from current or desired matrix of frame F.  */
 
 static int
-line_hash_code (struct glyph_row *row)
+line_hash_code (struct frame *f, struct glyph_row *row)
 {
   int hash = 0;
 
@@ -1086,7 +1087,7 @@
        {
          int c = glyph->u.ch;
          int face_id = glyph->face_id;
-         if (FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is 
SELECTED_FRAME OK here? */
+         if (FRAME_MUST_WRITE_SPACES (f))
            c -= SPACEGLYPH;
          hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c;
          hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id;
@@ -1101,12 +1102,13 @@
 }
 
 
-/* Return the cost of drawing line VPOS in MATRIX.  The cost equals
-   the number of characters in the line.  If must_write_spaces is
-   zero, leading and trailing spaces are ignored.  */
+/* Return the cost of drawing line VPOS in MATRIX, which may
+   be current or desired matrix of frame F.  The cost equals
+   the number of characters in the line.  If must_write_spaces
+   is zero, leading and trailing spaces are ignored.  */
 
 static int
-line_draw_cost (struct glyph_matrix *matrix, int vpos)
+line_draw_cost (struct frame *f, struct glyph_matrix *matrix, int vpos)
 {
   struct glyph_row *row = matrix->rows + vpos;
   struct glyph *beg = row->glyphs[TEXT_AREA];
@@ -1116,7 +1118,7 @@
   ptrdiff_t glyph_table_len = GLYPH_TABLE_LENGTH;
 
   /* Ignore trailing and leading spaces if we can.  */
-  if (!FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME 
OK here? */
+  if (!FRAME_MUST_WRITE_SPACES (f))
     {
       /* Skip from the end over trailing spaces.  */
       while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))
@@ -4595,8 +4597,7 @@
   struct glyph_matrix *current_matrix = frame->current_matrix;
   struct glyph_matrix *desired_matrix = frame->desired_matrix;
 
-  if (!current_matrix)
-    emacs_abort ();
+  eassert (current_matrix);
 
   /* Compute hash codes of all the lines.  Also calculate number of
      changed lines, number of unchanged lines at the beginning, and
@@ -4609,7 +4610,7 @@
       /* Give up on this scrolling if some old lines are not enabled.  */
       if (!MATRIX_ROW_ENABLED_P (current_matrix, i))
        return 0;
-      old_hash[i] = line_hash_code (MATRIX_ROW (current_matrix, i));
+      old_hash[i] = line_hash_code (frame, MATRIX_ROW (current_matrix, i));
       if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
        {
          /* This line cannot be redrawn, so don't let scrolling mess it.  */
@@ -4619,8 +4620,8 @@
        }
       else
        {
-         new_hash[i] = line_hash_code (MATRIX_ROW (desired_matrix, i));
-         draw_cost[i] = line_draw_cost (desired_matrix, i);
+         new_hash[i] = line_hash_code (frame, MATRIX_ROW (desired_matrix, i));
+         draw_cost[i] = line_draw_cost (frame, desired_matrix, i);
        }
 
       if (old_hash[i] != new_hash[i])
@@ -4630,7 +4631,7 @@
        }
       else if (i == unchanged_at_top)
        unchanged_at_top++;
-      old_draw_cost[i] = line_draw_cost (current_matrix, i);
+      old_draw_cost[i] = line_draw_cost (frame, current_matrix, i);
     }
 
   /* If changed lines are few, don't allow preemption, don't scroll.  */

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2013-10-14 10:55:24 +0000
+++ b/src/nsterm.m      2013-10-14 12:19:21 +0000
@@ -4091,11 +4091,6 @@
   terminal->delete_frame_hook = x_destroy_window;
   terminal->delete_terminal_hook = ns_delete_terminal;
 
-  terminal->scroll_region_ok = 1;
-  terminal->char_ins_del_ok = 1;
-  terminal->line_ins_del_ok = 1;
-  terminal->memory_below_frame = 0;
-
   return terminal;
 }
 

=== modified file 'src/term.c'
--- a/src/term.c        2013-10-14 10:55:24 +0000
+++ b/src/term.c        2013-10-14 12:19:21 +0000
@@ -4203,9 +4203,9 @@
   /* Since we make MagicWrap terminals look like AutoWrap, we need to have
      the former flag imply the latter.  */
   AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
-  terminal->memory_below_frame = tgetflag ("db");
+  tty->memory_below_frame = tgetflag ("db");
   tty->TF_hazeltine = tgetflag ("hz");
-  terminal->must_write_spaces = tgetflag ("in");
+  tty->must_write_spaces = tgetflag ("in");
   tty->meta_key = tgetflag ("km") || tgetflag ("MT");
   tty->TF_insmode_motion = tgetflag ("mi");
   tty->TF_standout_motion = tgetflag ("ms");
@@ -4225,7 +4225,7 @@
     tty->specified_window = height;
 
     FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
-    terminal->char_ins_del_ok = 1;
+    tty->char_ins_del_ok = 1;
     baud_rate = 19200;
   }
 #else  /* MSDOS */
@@ -4238,7 +4238,7 @@
     get_tty_size (fileno (tty->input), &width, &height);
     FrameCols (tty) = width;
     FrameRows (tty) = height;
-    terminal->char_ins_del_ok = 0;
+    tty->char_ins_del_ok = 0;
     init_baud_rate (fileno (tty->input));
   }
 #endif /* MSDOS */
@@ -4257,12 +4257,12 @@
   tty->delete_in_insert_mode = 1;
 
   UseTabs (tty) = 0;
-  terminal->scroll_region_ok = 0;
+  tty->scroll_region_ok = 0;
 
   /* Seems to insert lines when it's not supposed to, messing up the
      display.  In doing a trace, it didn't seem to be called much, so I
      don't think we're losing anything by turning it off.  */
-  terminal->line_ins_del_ok = 0;
+  tty->line_ins_del_ok = 0;
 
   tty->TN_max_colors = 16;  /* Must be non-zero for tty-display-color-p.  */
 #endif /* DOS_NT */
@@ -4393,17 +4393,17 @@
 
   UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
 
-  terminal->scroll_region_ok
+  tty->scroll_region_ok
     = (tty->Wcm->cm_abs
        && (tty->TS_set_window || tty->TS_set_scroll_region || 
tty->TS_set_scroll_region_1));
 
-  terminal->line_ins_del_ok
+  tty->line_ins_del_ok
     = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
         && (tty->TS_del_line || tty->TS_del_multi_lines))
-       || (terminal->scroll_region_ok
+       || (tty->scroll_region_ok
            && tty->TS_fwd_scroll && tty->TS_rev_scroll));
 
-  terminal->char_ins_del_ok
+  tty->char_ins_del_ok
     = ((tty->TS_ins_char || tty->TS_insert_mode
         || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars)
        && (tty->TS_del_char || tty->TS_del_multi_chars));

=== modified file 'src/termchar.h'
--- a/src/termchar.h    2013-09-26 07:37:16 +0000
+++ b/src/termchar.h    2013-10-14 12:19:21 +0000
@@ -197,6 +197,25 @@
 
   /* Non-zero means we are displaying a TTY menu on this tty.  */
   unsigned showing_menu : 1;
+
+  /* Nonzero means spaces in the text must actually be output;
+     can't just skip over some columns to leave them blank.  */
+  unsigned must_write_spaces : 1;
+
+  /* Nonzero if TTY can insert and delete lines.  */
+  unsigned line_ins_del_ok : 1;
+
+  /* Nonzero if TTY can insert and delete chars.  */
+  unsigned char_ins_del_ok : 1;
+
+  /* Nonzero if TTY supports setting the scroll window.  */
+  unsigned scroll_region_ok : 1;
+
+  /* Nonzero if TTY remembers lines scrolled off bottom.  */
+  unsigned memory_below_frame : 1;
+
+  /* Cost of setting the scroll window, measured in characters.  */
+  int scroll_region_cost;      
 };
 
 /* A chain of structures for all tty devices currently in use. */

=== modified file 'src/termhooks.h'
--- a/src/termhooks.h   2013-10-14 10:55:24 +0000
+++ b/src/termhooks.h   2013-10-14 12:19:21 +0000
@@ -402,21 +402,6 @@
      the function `set-keyboard-coding-system'.  */
   struct coding_system *keyboard_coding;
 
-  /* Terminal characteristics.  */
-  /* XXX Are these really used on non-termcap displays?  */
-
-  int must_write_spaces;       /* Nonzero means spaces in the text must
-                                  actually be output; can't just skip over
-                                  some columns to leave them blank.  */
-  int line_ins_del_ok;          /* Terminal can insert and delete lines.  */
-  int char_ins_del_ok;          /* Terminal can insert and delete chars.  */
-  int scroll_region_ok;         /* Terminal supports setting the scroll
-                                   window.  */
-  int scroll_region_cost;      /* Cost of setting the scroll window,
-                                   measured in characters.  */
-  int memory_below_frame;      /* Terminal remembers lines scrolled
-                                   off bottom.  */
-
   /* Window-based redisplay interface for this device (0 for tty
      devices). */
   struct redisplay_interface *rif;
@@ -617,12 +602,12 @@
 /* Chain of all terminal devices currently in use.  */
 extern struct terminal *terminal_list;
 
-#define FRAME_MUST_WRITE_SPACES(f) ((f)->terminal->must_write_spaces)
-#define FRAME_LINE_INS_DEL_OK(f) ((f)->terminal->line_ins_del_ok)
-#define FRAME_CHAR_INS_DEL_OK(f) ((f)->terminal->char_ins_del_ok)
-#define FRAME_SCROLL_REGION_OK(f) ((f)->terminal->scroll_region_ok)
-#define FRAME_SCROLL_REGION_COST(f) ((f)->terminal->scroll_region_cost)
-#define FRAME_MEMORY_BELOW_FRAME(f) ((f)->terminal->memory_below_frame)
+#define FRAME_MUST_WRITE_SPACES(f) (FRAME_TTY (f)->must_write_spaces)
+#define FRAME_LINE_INS_DEL_OK(f) (FRAME_TTY (f)->line_ins_del_ok)
+#define FRAME_CHAR_INS_DEL_OK(f) (FRAME_TTY (f)->char_ins_del_ok)
+#define FRAME_SCROLL_REGION_OK(f) (FRAME_TTY (f)->scroll_region_ok)
+#define FRAME_SCROLL_REGION_COST(f) (FRAME_TTY (f)->scroll_region_cost)
+#define FRAME_MEMORY_BELOW_FRAME(f) (FRAME_TTY (f)->memory_below_frame)
 
 #define FRAME_TERMINAL_CODING(f) ((f)->terminal->terminal_coding)
 #define FRAME_KEYBOARD_CODING(f) ((f)->terminal->keyboard_coding)

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2013-10-14 10:55:24 +0000
+++ b/src/w32term.c     2013-10-14 12:19:21 +0000
@@ -6252,11 +6252,6 @@
   terminal->delete_terminal_hook = x_delete_terminal;
 
   terminal->rif = &w32_redisplay_interface;
-  terminal->scroll_region_ok = 1;    /* We'll scroll partial frames. */
-  terminal->char_ins_del_ok = 1;
-  terminal->line_ins_del_ok = 1;         /* We'll just blt 'em. */
-  terminal->memory_below_frame = 0;   /* We don't remember what scrolls
-                                        off the bottom. */
 
   /* We don't yet support separate terminals on W32, so don't try to share
      keyboards between virtual terminals that are on the same physical

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-10-14 10:55:24 +0000
+++ b/src/xterm.c       2013-10-14 12:19:21 +0000
@@ -10509,11 +10509,6 @@
   terminal->delete_terminal_hook = x_delete_terminal;
 
   terminal->rif = &x_redisplay_interface;
-  terminal->scroll_region_ok = 1;    /* We'll scroll partial frames. */
-  terminal->char_ins_del_ok = 1;
-  terminal->line_ins_del_ok = 1;         /* We'll just blt 'em. */
-  terminal->memory_below_frame = 0;   /* We don't remember what scrolls
-                                        off the bottom. */
 
   return terminal;
 }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]