aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-10-14 16:19:21 +0400
committerDmitry Antipov2013-10-14 16:19:21 +0400
commit77e3b1b7095b3376dbddd22cbca4827b797767c0 (patch)
tree1e5cbc68a42c7e1b08acf36d94bc4b158d6117a0 /src
parente558436b778c0199caaff0ce40b9a279bacf640e (diff)
downloademacs-77e3b1b7095b3376dbddd22cbca4827b797767c0.tar.gz
emacs-77e3b1b7095b3376dbddd22cbca4827b797767c0.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog19
-rw-r--r--src/dispnew.c29
-rw-r--r--src/nsterm.m5
-rw-r--r--src/term.c20
-rw-r--r--src/termchar.h19
-rw-r--r--src/termhooks.h27
-rw-r--r--src/w32term.c5
-rw-r--r--src/xterm.c5
8 files changed, 69 insertions, 60 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9432c81ffd7..d9264f6a691 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,24 @@
12013-10-14 Dmitry Antipov <dmantipov@yandex.ru> 12013-10-14 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 * termhooks.h (FRAME_MUST_WRITE_SPACES, FRAME_LINE_INS_DEL_OK)
4 (FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK)
5 (FRAME_SCROLL_REGION_COST, FRAME_MEMORY_BELOW_FRAME):
6 Adjust to match the change described below.
7 (struct terminal): Move must_write_spaces, line_ins_del_ok,
8 char_ins_del_ok, scroll_region_ok, scroll_region_cost and
9 memory_below_frame members to...
10 * termchar.h (struct tty_display_info): ...here because they're
11 relevant only on TTYs. Prefer unsigned bitfield where appropriate.
12 * term.c (init_tty):
13 * nsterm.m (ns_create_terminal):
14 * w32term.c (w32_create_terminal):
15 * xterm.c (x_create_terminal): Adjust users.
16 * dispnew.c (line_hash_code, line_draw_cost): Pass frame arg
17 to filter out non-TTY frames. Adjust comment.
18 (scrolling): Adjust user. Prefer eassert for debugging check.
19
202013-10-14 Dmitry Antipov <dmantipov@yandex.ru>
21
3 * xfaces.c (PT_PER_INCH): Remove unused macro. 22 * xfaces.c (PT_PER_INCH): Remove unused macro.
4 * termhooks.h (struct terminal): Remove set-but-unused 23 * termhooks.h (struct terminal): Remove set-but-unused
5 member fast_clear_end_of_line. 24 member fast_clear_end_of_line.
diff --git a/src/dispnew.c b/src/dispnew.c
index 3c0fda0b745..25acdd725dd 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1070,10 +1070,11 @@ prepare_desired_row (struct glyph_row *row)
1070} 1070}
1071 1071
1072 1072
1073/* Return a hash code for glyph row ROW. */ 1073/* Return a hash code for glyph row ROW, which may
1074 be from current or desired matrix of frame F. */
1074 1075
1075static int 1076static int
1076line_hash_code (struct glyph_row *row) 1077line_hash_code (struct frame *f, struct glyph_row *row)
1077{ 1078{
1078 int hash = 0; 1079 int hash = 0;
1079 1080
@@ -1086,7 +1087,7 @@ line_hash_code (struct glyph_row *row)
1086 { 1087 {
1087 int c = glyph->u.ch; 1088 int c = glyph->u.ch;
1088 int face_id = glyph->face_id; 1089 int face_id = glyph->face_id;
1089 if (FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */ 1090 if (FRAME_MUST_WRITE_SPACES (f))
1090 c -= SPACEGLYPH; 1091 c -= SPACEGLYPH;
1091 hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c; 1092 hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c;
1092 hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id; 1093 hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id;
@@ -1101,12 +1102,13 @@ line_hash_code (struct glyph_row *row)
1101} 1102}
1102 1103
1103 1104
1104/* Return the cost of drawing line VPOS in MATRIX. The cost equals 1105/* Return the cost of drawing line VPOS in MATRIX, which may
1105 the number of characters in the line. If must_write_spaces is 1106 be current or desired matrix of frame F. The cost equals
1106 zero, leading and trailing spaces are ignored. */ 1107 the number of characters in the line. If must_write_spaces
1108 is zero, leading and trailing spaces are ignored. */
1107 1109
1108static int 1110static int
1109line_draw_cost (struct glyph_matrix *matrix, int vpos) 1111line_draw_cost (struct frame *f, struct glyph_matrix *matrix, int vpos)
1110{ 1112{
1111 struct glyph_row *row = matrix->rows + vpos; 1113 struct glyph_row *row = matrix->rows + vpos;
1112 struct glyph *beg = row->glyphs[TEXT_AREA]; 1114 struct glyph *beg = row->glyphs[TEXT_AREA];
@@ -1116,7 +1118,7 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
1116 ptrdiff_t glyph_table_len = GLYPH_TABLE_LENGTH; 1118 ptrdiff_t glyph_table_len = GLYPH_TABLE_LENGTH;
1117 1119
1118 /* Ignore trailing and leading spaces if we can. */ 1120 /* Ignore trailing and leading spaces if we can. */
1119 if (!FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */ 1121 if (!FRAME_MUST_WRITE_SPACES (f))
1120 { 1122 {
1121 /* Skip from the end over trailing spaces. */ 1123 /* Skip from the end over trailing spaces. */
1122 while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1))) 1124 while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))
@@ -4595,8 +4597,7 @@ scrolling (struct frame *frame)
4595 struct glyph_matrix *current_matrix = frame->current_matrix; 4597 struct glyph_matrix *current_matrix = frame->current_matrix;
4596 struct glyph_matrix *desired_matrix = frame->desired_matrix; 4598 struct glyph_matrix *desired_matrix = frame->desired_matrix;
4597 4599
4598 if (!current_matrix) 4600 eassert (current_matrix);
4599 emacs_abort ();
4600 4601
4601 /* Compute hash codes of all the lines. Also calculate number of 4602 /* Compute hash codes of all the lines. Also calculate number of
4602 changed lines, number of unchanged lines at the beginning, and 4603 changed lines, number of unchanged lines at the beginning, and
@@ -4609,7 +4610,7 @@ scrolling (struct frame *frame)
4609 /* Give up on this scrolling if some old lines are not enabled. */ 4610 /* Give up on this scrolling if some old lines are not enabled. */
4610 if (!MATRIX_ROW_ENABLED_P (current_matrix, i)) 4611 if (!MATRIX_ROW_ENABLED_P (current_matrix, i))
4611 return 0; 4612 return 0;
4612 old_hash[i] = line_hash_code (MATRIX_ROW (current_matrix, i)); 4613 old_hash[i] = line_hash_code (frame, MATRIX_ROW (current_matrix, i));
4613 if (! MATRIX_ROW_ENABLED_P (desired_matrix, i)) 4614 if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
4614 { 4615 {
4615 /* This line cannot be redrawn, so don't let scrolling mess it. */ 4616 /* This line cannot be redrawn, so don't let scrolling mess it. */
@@ -4619,8 +4620,8 @@ scrolling (struct frame *frame)
4619 } 4620 }
4620 else 4621 else
4621 { 4622 {
4622 new_hash[i] = line_hash_code (MATRIX_ROW (desired_matrix, i)); 4623 new_hash[i] = line_hash_code (frame, MATRIX_ROW (desired_matrix, i));
4623 draw_cost[i] = line_draw_cost (desired_matrix, i); 4624 draw_cost[i] = line_draw_cost (frame, desired_matrix, i);
4624 } 4625 }
4625 4626
4626 if (old_hash[i] != new_hash[i]) 4627 if (old_hash[i] != new_hash[i])
@@ -4630,7 +4631,7 @@ scrolling (struct frame *frame)
4630 } 4631 }
4631 else if (i == unchanged_at_top) 4632 else if (i == unchanged_at_top)
4632 unchanged_at_top++; 4633 unchanged_at_top++;
4633 old_draw_cost[i] = line_draw_cost (current_matrix, i); 4634 old_draw_cost[i] = line_draw_cost (frame, current_matrix, i);
4634 } 4635 }
4635 4636
4636 /* If changed lines are few, don't allow preemption, don't scroll. */ 4637 /* If changed lines are few, don't allow preemption, don't scroll. */
diff --git a/src/nsterm.m b/src/nsterm.m
index 5f034a4dff3..b0067d85eae 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4091,11 +4091,6 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
4091 terminal->delete_frame_hook = x_destroy_window; 4091 terminal->delete_frame_hook = x_destroy_window;
4092 terminal->delete_terminal_hook = ns_delete_terminal; 4092 terminal->delete_terminal_hook = ns_delete_terminal;
4093 4093
4094 terminal->scroll_region_ok = 1;
4095 terminal->char_ins_del_ok = 1;
4096 terminal->line_ins_del_ok = 1;
4097 terminal->memory_below_frame = 0;
4098
4099 return terminal; 4094 return terminal;
4100} 4095}
4101 4096
diff --git a/src/term.c b/src/term.c
index 7cf0795aa7d..58e0f2abd45 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4203,9 +4203,9 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
4203 /* Since we make MagicWrap terminals look like AutoWrap, we need to have 4203 /* Since we make MagicWrap terminals look like AutoWrap, we need to have
4204 the former flag imply the latter. */ 4204 the former flag imply the latter. */
4205 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); 4205 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
4206 terminal->memory_below_frame = tgetflag ("db"); 4206 tty->memory_below_frame = tgetflag ("db");
4207 tty->TF_hazeltine = tgetflag ("hz"); 4207 tty->TF_hazeltine = tgetflag ("hz");
4208 terminal->must_write_spaces = tgetflag ("in"); 4208 tty->must_write_spaces = tgetflag ("in");
4209 tty->meta_key = tgetflag ("km") || tgetflag ("MT"); 4209 tty->meta_key = tgetflag ("km") || tgetflag ("MT");
4210 tty->TF_insmode_motion = tgetflag ("mi"); 4210 tty->TF_insmode_motion = tgetflag ("mi");
4211 tty->TF_standout_motion = tgetflag ("ms"); 4211 tty->TF_standout_motion = tgetflag ("ms");
@@ -4225,7 +4225,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
4225 tty->specified_window = height; 4225 tty->specified_window = height;
4226 4226
4227 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; 4227 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
4228 terminal->char_ins_del_ok = 1; 4228 tty->char_ins_del_ok = 1;
4229 baud_rate = 19200; 4229 baud_rate = 19200;
4230 } 4230 }
4231#else /* MSDOS */ 4231#else /* MSDOS */
@@ -4238,7 +4238,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
4238 get_tty_size (fileno (tty->input), &width, &height); 4238 get_tty_size (fileno (tty->input), &width, &height);
4239 FrameCols (tty) = width; 4239 FrameCols (tty) = width;
4240 FrameRows (tty) = height; 4240 FrameRows (tty) = height;
4241 terminal->char_ins_del_ok = 0; 4241 tty->char_ins_del_ok = 0;
4242 init_baud_rate (fileno (tty->input)); 4242 init_baud_rate (fileno (tty->input));
4243 } 4243 }
4244#endif /* MSDOS */ 4244#endif /* MSDOS */
@@ -4257,12 +4257,12 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
4257 tty->delete_in_insert_mode = 1; 4257 tty->delete_in_insert_mode = 1;
4258 4258
4259 UseTabs (tty) = 0; 4259 UseTabs (tty) = 0;
4260 terminal->scroll_region_ok = 0; 4260 tty->scroll_region_ok = 0;
4261 4261
4262 /* Seems to insert lines when it's not supposed to, messing up the 4262 /* Seems to insert lines when it's not supposed to, messing up the
4263 display. In doing a trace, it didn't seem to be called much, so I 4263 display. In doing a trace, it didn't seem to be called much, so I
4264 don't think we're losing anything by turning it off. */ 4264 don't think we're losing anything by turning it off. */
4265 terminal->line_ins_del_ok = 0; 4265 tty->line_ins_del_ok = 0;
4266 4266
4267 tty->TN_max_colors = 16; /* Must be non-zero for tty-display-color-p. */ 4267 tty->TN_max_colors = 16; /* Must be non-zero for tty-display-color-p. */
4268#endif /* DOS_NT */ 4268#endif /* DOS_NT */
@@ -4393,17 +4393,17 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
4393 4393
4394 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8; 4394 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
4395 4395
4396 terminal->scroll_region_ok 4396 tty->scroll_region_ok
4397 = (tty->Wcm->cm_abs 4397 = (tty->Wcm->cm_abs
4398 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); 4398 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1));
4399 4399
4400 terminal->line_ins_del_ok 4400 tty->line_ins_del_ok
4401 = (((tty->TS_ins_line || tty->TS_ins_multi_lines) 4401 = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
4402 && (tty->TS_del_line || tty->TS_del_multi_lines)) 4402 && (tty->TS_del_line || tty->TS_del_multi_lines))
4403 || (terminal->scroll_region_ok 4403 || (tty->scroll_region_ok
4404 && tty->TS_fwd_scroll && tty->TS_rev_scroll)); 4404 && tty->TS_fwd_scroll && tty->TS_rev_scroll));
4405 4405
4406 terminal->char_ins_del_ok 4406 tty->char_ins_del_ok
4407 = ((tty->TS_ins_char || tty->TS_insert_mode 4407 = ((tty->TS_ins_char || tty->TS_insert_mode
4408 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) 4408 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars)
4409 && (tty->TS_del_char || tty->TS_del_multi_chars)); 4409 && (tty->TS_del_char || tty->TS_del_multi_chars));
diff --git a/src/termchar.h b/src/termchar.h
index 031f4e4034b..feb89e02d0e 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -197,6 +197,25 @@ struct tty_display_info
197 197
198 /* Non-zero means we are displaying a TTY menu on this tty. */ 198 /* Non-zero means we are displaying a TTY menu on this tty. */
199 unsigned showing_menu : 1; 199 unsigned showing_menu : 1;
200
201 /* Nonzero means spaces in the text must actually be output;
202 can't just skip over some columns to leave them blank. */
203 unsigned must_write_spaces : 1;
204
205 /* Nonzero if TTY can insert and delete lines. */
206 unsigned line_ins_del_ok : 1;
207
208 /* Nonzero if TTY can insert and delete chars. */
209 unsigned char_ins_del_ok : 1;
210
211 /* Nonzero if TTY supports setting the scroll window. */
212 unsigned scroll_region_ok : 1;
213
214 /* Nonzero if TTY remembers lines scrolled off bottom. */
215 unsigned memory_below_frame : 1;
216
217 /* Cost of setting the scroll window, measured in characters. */
218 int scroll_region_cost;
200}; 219};
201 220
202/* A chain of structures for all tty devices currently in use. */ 221/* A chain of structures for all tty devices currently in use. */
diff --git a/src/termhooks.h b/src/termhooks.h
index 2c819ad58e3..52f30b4bf98 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -402,21 +402,6 @@ struct terminal
402 the function `set-keyboard-coding-system'. */ 402 the function `set-keyboard-coding-system'. */
403 struct coding_system *keyboard_coding; 403 struct coding_system *keyboard_coding;
404 404
405 /* Terminal characteristics. */
406 /* XXX Are these really used on non-termcap displays? */
407
408 int must_write_spaces; /* Nonzero means spaces in the text must
409 actually be output; can't just skip over
410 some columns to leave them blank. */
411 int line_ins_del_ok; /* Terminal can insert and delete lines. */
412 int char_ins_del_ok; /* Terminal can insert and delete chars. */
413 int scroll_region_ok; /* Terminal supports setting the scroll
414 window. */
415 int scroll_region_cost; /* Cost of setting the scroll window,
416 measured in characters. */
417 int memory_below_frame; /* Terminal remembers lines scrolled
418 off bottom. */
419
420 /* Window-based redisplay interface for this device (0 for tty 405 /* Window-based redisplay interface for this device (0 for tty
421 devices). */ 406 devices). */
422 struct redisplay_interface *rif; 407 struct redisplay_interface *rif;
@@ -617,12 +602,12 @@ tset_selection_alist (struct terminal *t, Lisp_Object val)
617/* Chain of all terminal devices currently in use. */ 602/* Chain of all terminal devices currently in use. */
618extern struct terminal *terminal_list; 603extern struct terminal *terminal_list;
619 604
620#define FRAME_MUST_WRITE_SPACES(f) ((f)->terminal->must_write_spaces) 605#define FRAME_MUST_WRITE_SPACES(f) (FRAME_TTY (f)->must_write_spaces)
621#define FRAME_LINE_INS_DEL_OK(f) ((f)->terminal->line_ins_del_ok) 606#define FRAME_LINE_INS_DEL_OK(f) (FRAME_TTY (f)->line_ins_del_ok)
622#define FRAME_CHAR_INS_DEL_OK(f) ((f)->terminal->char_ins_del_ok) 607#define FRAME_CHAR_INS_DEL_OK(f) (FRAME_TTY (f)->char_ins_del_ok)
623#define FRAME_SCROLL_REGION_OK(f) ((f)->terminal->scroll_region_ok) 608#define FRAME_SCROLL_REGION_OK(f) (FRAME_TTY (f)->scroll_region_ok)
624#define FRAME_SCROLL_REGION_COST(f) ((f)->terminal->scroll_region_cost) 609#define FRAME_SCROLL_REGION_COST(f) (FRAME_TTY (f)->scroll_region_cost)
625#define FRAME_MEMORY_BELOW_FRAME(f) ((f)->terminal->memory_below_frame) 610#define FRAME_MEMORY_BELOW_FRAME(f) (FRAME_TTY (f)->memory_below_frame)
626 611
627#define FRAME_TERMINAL_CODING(f) ((f)->terminal->terminal_coding) 612#define FRAME_TERMINAL_CODING(f) ((f)->terminal->terminal_coding)
628#define FRAME_KEYBOARD_CODING(f) ((f)->terminal->keyboard_coding) 613#define FRAME_KEYBOARD_CODING(f) ((f)->terminal->keyboard_coding)
diff --git a/src/w32term.c b/src/w32term.c
index 1073179fa34..b128fbeaa9c 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6252,11 +6252,6 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6252 terminal->delete_terminal_hook = x_delete_terminal; 6252 terminal->delete_terminal_hook = x_delete_terminal;
6253 6253
6254 terminal->rif = &w32_redisplay_interface; 6254 terminal->rif = &w32_redisplay_interface;
6255 terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */
6256 terminal->char_ins_del_ok = 1;
6257 terminal->line_ins_del_ok = 1; /* We'll just blt 'em. */
6258 terminal->memory_below_frame = 0; /* We don't remember what scrolls
6259 off the bottom. */
6260 6255
6261 /* We don't yet support separate terminals on W32, so don't try to share 6256 /* We don't yet support separate terminals on W32, so don't try to share
6262 keyboards between virtual terminals that are on the same physical 6257 keyboards between virtual terminals that are on the same physical
diff --git a/src/xterm.c b/src/xterm.c
index f73c093cefc..9d1107e10bd 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10509,11 +10509,6 @@ x_create_terminal (struct x_display_info *dpyinfo)
10509 terminal->delete_terminal_hook = x_delete_terminal; 10509 terminal->delete_terminal_hook = x_delete_terminal;
10510 10510
10511 terminal->rif = &x_redisplay_interface; 10511 terminal->rif = &x_redisplay_interface;
10512 terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */
10513 terminal->char_ins_del_ok = 1;
10514 terminal->line_ins_del_ok = 1; /* We'll just blt 'em. */
10515 terminal->memory_below_frame = 0; /* We don't remember what scrolls
10516 off the bottom. */
10517 10512
10518 return terminal; 10513 return terminal;
10519} 10514}