aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c77
1 files changed, 36 insertions, 41 deletions
diff --git a/src/term.c b/src/term.c
index 5c25c7419dc..50d47a1dac1 100644
--- a/src/term.c
+++ b/src/term.c
@@ -83,28 +83,13 @@ static void tty_hide_cursor P_ ((void));
83 83
84Lisp_Object Vring_bell_function; 84Lisp_Object Vring_bell_function;
85 85
86/* Terminal characteristics that higher levels want to look at. 86/* Terminal characteristics that higher levels want to look at. */
87 These are all extern'd in termchar.h */ 87static struct terminal _current_terminal;
88 88TERMINAL_PTR current_terminal = &_current_terminal;
89int must_write_spaces; /* Nonzero means spaces in the text
90 must actually be output; can't just skip
91 over some columns to leave them blank. */
92int min_padding_speed; /* Speed below which no padding necessary */
93
94int line_ins_del_ok; /* Terminal can insert and delete lines */
95int char_ins_del_ok; /* Terminal can insert and delete chars */
96int scroll_region_ok; /* Terminal supports setting the
97 scroll window */
98int scroll_region_cost; /* Cost of setting a scroll window,
99 measured in characters */
100int memory_below_frame; /* Terminal remembers lines
101 scrolled off bottom */
102int fast_clear_end_of_line; /* Terminal has a `ce' string */
103 89
104/* Nonzero means no need to redraw the entire frame on resuming 90/* Nonzero means no need to redraw the entire frame on resuming
105 a suspended Emacs. This is useful on terminals with multiple pages, 91 a suspended Emacs. This is useful on terminals with multiple pages,
106 where one page is used for Emacs and another for all else. */ 92 where one page is used for Emacs and another for all else. */
107
108int no_redraw_on_reenter; 93int no_redraw_on_reenter;
109 94
110/* Hook functions that you can set to snap out the functions in this file. 95/* Hook functions that you can set to snap out the functions in this file.
@@ -505,7 +490,7 @@ set_terminal_window (size)
505 if (FRAME_TERMCAP_P (updating_frame)) 490 if (FRAME_TERMCAP_P (updating_frame))
506 { 491 {
507 specified_window = size ? size : FRAME_LINES (updating_frame); 492 specified_window = size ? size : FRAME_LINES (updating_frame);
508 if (scroll_region_ok) 493 if (TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ()))
509 set_scroll_region (0, specified_window); 494 set_scroll_region (0, specified_window);
510 } 495 }
511 else 496 else
@@ -1151,9 +1136,11 @@ ins_del_lines (vpos, n)
1151 /* If the lines below the deletion are blank lines coming 1136 /* If the lines below the deletion are blank lines coming
1152 out of the end of the window, don't bother, 1137 out of the end of the window, don't bother,
1153 as there will be a matching inslines later that will flush them. */ 1138 as there will be a matching inslines later that will flush them. */
1154 if (scroll_region_ok && vpos + i >= specified_window) 1139 if (TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ())
1140 && vpos + i >= specified_window)
1155 return; 1141 return;
1156 if (!memory_below_frame && vpos + i >= FRAME_LINES (sf)) 1142 if (!TERMINAL_MEMORY_BELOW_FRAME (CURRENT_TERMINAL ())
1143 && vpos + i >= FRAME_LINES (sf))
1157 return; 1144 return;
1158 1145
1159 if (multi) 1146 if (multi)
@@ -1186,7 +1173,9 @@ ins_del_lines (vpos, n)
1186 set_scroll_region (0, specified_window); 1173 set_scroll_region (0, specified_window);
1187 } 1174 }
1188 1175
1189 if (!scroll_region_ok && memory_below_frame && n < 0) 1176 if (!TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ())
1177 && TERMINAL_MEMORY_BELOW_FRAME (CURRENT_TERMINAL ())
1178 && n < 0)
1190 { 1179 {
1191 cursor_to (FRAME_LINES (sf) + n, 0); 1180 cursor_to (FRAME_LINES (sf) + n, 0);
1192 clear_to_end (); 1181 clear_to_end ();
@@ -1317,7 +1306,7 @@ calculate_costs (frame)
1317 1306
1318 FRAME_COST_BAUD_RATE (frame) = baud_rate; 1307 FRAME_COST_BAUD_RATE (frame) = baud_rate;
1319 1308
1320 scroll_region_cost = string_cost (f); 1309 TERMINAL_SCROLL_REGION_COST (CURRENT_TERMINAL ()) = string_cost (f);
1321 1310
1322 /* These variables are only used for terminal stuff. They are allocated 1311 /* These variables are only used for terminal stuff. They are allocated
1323 once for the terminal frame of X-windows emacs, but not used afterwards. 1312 once for the terminal frame of X-windows emacs, but not used afterwards.
@@ -2185,15 +2174,15 @@ term_init (terminal_type)
2185 delete_in_insert_mode = 1; 2174 delete_in_insert_mode = 1;
2186 2175
2187 UseTabs = 0; 2176 UseTabs = 0;
2188 scroll_region_ok = 0; 2177 TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ()) = 0;
2189 2178
2190 /* Seems to insert lines when it's not supposed to, messing 2179 /* Seems to insert lines when it's not supposed to, messing
2191 up the display. In doing a trace, it didn't seem to be 2180 up the display. In doing a trace, it didn't seem to be
2192 called much, so I don't think we're losing anything by 2181 called much, so I don't think we're losing anything by
2193 turning it off. */ 2182 turning it off. */
2194 2183
2195 line_ins_del_ok = 0; 2184 TERMINAL_LINE_INS_DEL_OK (CURRENT_TERMINAL ()) = 0;
2196 char_ins_del_ok = 1; 2185 TERMINAL_CHAR_INS_DEL_OK (CURRENT_TERMINAL ()) = 1;
2197 2186
2198 baud_rate = 19200; 2187 baud_rate = 19200;
2199 2188
@@ -2346,9 +2335,9 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2346 /* Since we make MagicWrap terminals look like AutoWrap, we need to have 2335 /* Since we make MagicWrap terminals look like AutoWrap, we need to have
2347 the former flag imply the latter. */ 2336 the former flag imply the latter. */
2348 AutoWrap = MagicWrap || tgetflag ("am"); 2337 AutoWrap = MagicWrap || tgetflag ("am");
2349 memory_below_frame = tgetflag ("db"); 2338 TERMINAL_MEMORY_BELOW_FRAME (CURRENT_TERMINAL ()) = tgetflag ("db");
2350 TF_hazeltine = tgetflag ("hz"); 2339 TF_hazeltine = tgetflag ("hz");
2351 must_write_spaces = tgetflag ("in"); 2340 TERMINAL_MUST_WRITE_SPACES (CURRENT_TERMINAL ()) = tgetflag ("in");
2352 meta_key = tgetflag ("km") || tgetflag ("MT"); 2341 meta_key = tgetflag ("km") || tgetflag ("MT");
2353 TF_insmode_motion = tgetflag ("mi"); 2342 TF_insmode_motion = tgetflag ("mi");
2354 TF_standout_motion = tgetflag ("ms"); 2343 TF_standout_motion = tgetflag ("ms");
@@ -2377,7 +2366,10 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2377 fatal ("Screen size %dx%d is too small", 2366 fatal ("Screen size %dx%d is too small",
2378 FRAME_LINES (sf), FRAME_COLS (sf)); 2367 FRAME_LINES (sf), FRAME_COLS (sf));
2379 2368
2380 min_padding_speed = tgetnum ("pb"); 2369#if 0 /* This is not used anywhere. */
2370 TERMINAL_MIN_PADDING_SPEED (CURRENT_TERMINAL ()) = tgetnum ("pb");
2371#endif
2372
2381 TabWidth = tgetnum ("tw"); 2373 TabWidth = tgetnum ("tw");
2382 2374
2383#ifdef VMS 2375#ifdef VMS
@@ -2453,7 +2445,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2453 2445
2454 if (!strcmp (terminal_type, "supdup")) 2446 if (!strcmp (terminal_type, "supdup"))
2455 { 2447 {
2456 memory_below_frame = 1; 2448 TERMINAL_MEMORY_BELOW_FRAME (CURRENT_TERMINAL ()) = 1;
2457 Wcm.cm_losewrap = 1; 2449 Wcm.cm_losewrap = 1;
2458 } 2450 }
2459 if (!strncmp (terminal_type, "c10", 3) 2451 if (!strncmp (terminal_type, "c10", 3)
@@ -2480,7 +2472,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2480 TS_set_window = "\033v%C %C %C %C "; 2472 TS_set_window = "\033v%C %C %C %C ";
2481 } 2473 }
2482 /* Termcap entry often fails to have :in: flag */ 2474 /* Termcap entry often fails to have :in: flag */
2483 must_write_spaces = 1; 2475 TERMINAL_MUST_WRITE_SPACES (CURRENT_TERMINAL ()) = 1;
2484 /* :ti string typically fails to have \E^G! in it */ 2476 /* :ti string typically fails to have \E^G! in it */
2485 /* This limits scope of insert-char to one line. */ 2477 /* This limits scope of insert-char to one line. */
2486 strcpy (area, TS_termcap_modes); 2478 strcpy (area, TS_termcap_modes);
@@ -2543,19 +2535,22 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2543 2535
2544 UseTabs = tabs_safe_p () && TabWidth == 8; 2536 UseTabs = tabs_safe_p () && TabWidth == 8;
2545 2537
2546 scroll_region_ok 2538 TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ())
2547 = (Wcm.cm_abs 2539 = (Wcm.cm_abs
2548 && (TS_set_window || TS_set_scroll_region || TS_set_scroll_region_1)); 2540 && (TS_set_window || TS_set_scroll_region || TS_set_scroll_region_1));
2549 2541
2550 line_ins_del_ok = (((TS_ins_line || TS_ins_multi_lines) 2542 TERMINAL_LINE_INS_DEL_OK (CURRENT_TERMINAL ())
2551 && (TS_del_line || TS_del_multi_lines)) 2543 = (((TS_ins_line || TS_ins_multi_lines)
2552 || (scroll_region_ok && TS_fwd_scroll && TS_rev_scroll)); 2544 && (TS_del_line || TS_del_multi_lines))
2553 2545 || (TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ())
2554 char_ins_del_ok = ((TS_ins_char || TS_insert_mode 2546 && TS_fwd_scroll && TS_rev_scroll));
2555 || TS_pad_inserted_char || TS_ins_multi_chars) 2547
2556 && (TS_del_char || TS_del_multi_chars)); 2548 TERMINAL_CHAR_INS_DEL_OK (CURRENT_TERMINAL ())
2557 2549 = ((TS_ins_char || TS_insert_mode
2558 fast_clear_end_of_line = TS_clr_line != 0; 2550 || TS_pad_inserted_char || TS_ins_multi_chars)
2551 && (TS_del_char || TS_del_multi_chars));
2552
2553 TERMINAL_FAST_CLEAR_END_OF_LINE (CURRENT_TERMINAL ()) = TS_clr_line != 0;
2559 2554
2560 init_baud_rate (); 2555 init_baud_rate ();
2561 if (read_socket_hook) /* Baudrate is somewhat */ 2556 if (read_socket_hook) /* Baudrate is somewhat */