aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/term.c b/src/term.c
index 4ecca5770a9..1df6e67a353 100644
--- a/src/term.c
+++ b/src/term.c
@@ -28,10 +28,10 @@ Boston, MA 02111-1307, USA. */
28 28
29#include <sys/file.h> 29#include <sys/file.h>
30 30
31#include "lisp.h"
31#include "systty.h" /* For emacs_tty in termchar.h */ 32#include "systty.h" /* For emacs_tty in termchar.h */
32#include "termchar.h" 33#include "termchar.h"
33#include "termopts.h" 34#include "termopts.h"
34#include "lisp.h"
35#include "charset.h" 35#include "charset.h"
36#include "coding.h" 36#include "coding.h"
37#include "keyboard.h" 37#include "keyboard.h"
@@ -123,7 +123,7 @@ void (*insert_glyphs_hook) P_ ((struct glyph *, int));
123void (*write_glyphs_hook) P_ ((struct glyph *, int)); 123void (*write_glyphs_hook) P_ ((struct glyph *, int));
124void (*delete_glyphs_hook) P_ ((int)); 124void (*delete_glyphs_hook) P_ ((int));
125 125
126int (*read_socket_hook) P_ ((int, struct input_event *, int, int)); 126int (*read_socket_hook) P_ ((struct input_event *, int, int));
127 127
128void (*frame_up_to_date_hook) P_ ((struct frame *)); 128void (*frame_up_to_date_hook) P_ ((struct frame *));
129 129
@@ -792,12 +792,11 @@ clear_end_of_line (first_unused_hpos)
792 } 792 }
793 else 793 else
794 { /* have to do it the hard way */ 794 { /* have to do it the hard way */
795 struct frame *sf = XFRAME (selected_frame);
796 turn_off_insert (); 795 turn_off_insert ();
797 796
798 /* Do not write in last row last col with Auto-wrap on. */ 797 /* Do not write in last row last col with Auto-wrap on. */
799 if (AutoWrap && curY == FRAME_LINES (sf) - 1 798 if (AutoWrap && curY == FRAME_LINES (f) - 1
800 && first_unused_hpos == FRAME_COLS (sf)) 799 && first_unused_hpos == FRAME_COLS (f))
801 first_unused_hpos--; 800 first_unused_hpos--;
802 801
803 for (i = curX; i < first_unused_hpos; i++) 802 for (i = curX; i < first_unused_hpos; i++)
@@ -925,8 +924,7 @@ write_glyphs (string, len)
925 register int len; 924 register int len;
926{ 925{
927 int produced, consumed; 926 int produced, consumed;
928 struct frame *sf = XFRAME (selected_frame); 927 struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame);
929 struct frame *f = updating_frame ? updating_frame : sf;
930 unsigned char conversion_buffer[1024]; 928 unsigned char conversion_buffer[1024];
931 int conversion_buffer_size = sizeof conversion_buffer; 929 int conversion_buffer_size = sizeof conversion_buffer;
932 930
@@ -944,8 +942,8 @@ write_glyphs (string, len)
944 since that would scroll the whole frame on some terminals. */ 942 since that would scroll the whole frame on some terminals. */
945 943
946 if (AutoWrap 944 if (AutoWrap
947 && curY + 1 == FRAME_LINES (sf) 945 && curY + 1 == FRAME_LINES (f)
948 && (curX + len) == FRAME_COLS (sf)) 946 && (curX + len) == FRAME_COLS (f))
949 len --; 947 len --;
950 if (len <= 0) 948 if (len <= 0)
951 return; 949 return;
@@ -1028,7 +1026,7 @@ insert_glyphs (start, len)
1028{ 1026{
1029 char *buf; 1027 char *buf;
1030 struct glyph *glyph = NULL; 1028 struct glyph *glyph = NULL;
1031 struct frame *f, *sf; 1029 struct frame *f;
1032 1030
1033 if (len <= 0) 1031 if (len <= 0)
1034 return; 1032 return;
@@ -1039,8 +1037,7 @@ insert_glyphs (start, len)
1039 return; 1037 return;
1040 } 1038 }
1041 1039
1042 sf = XFRAME (selected_frame); 1040 f = updating_frame ? updating_frame : XFRAME (selected_frame);
1043 f = updating_frame ? updating_frame : sf;
1044 1041
1045 if (TS_ins_multi_chars) 1042 if (TS_ins_multi_chars)
1046 { 1043 {
@@ -1159,7 +1156,7 @@ ins_del_lines (vpos, n)
1159 char *multi = n > 0 ? TS_ins_multi_lines : TS_del_multi_lines; 1156 char *multi = n > 0 ? TS_ins_multi_lines : TS_del_multi_lines;
1160 char *single = n > 0 ? TS_ins_line : TS_del_line; 1157 char *single = n > 0 ? TS_ins_line : TS_del_line;
1161 char *scroll = n > 0 ? TS_rev_scroll : TS_fwd_scroll; 1158 char *scroll = n > 0 ? TS_rev_scroll : TS_fwd_scroll;
1162 struct frame *sf; 1159 struct frame *f;
1163 1160
1164 register int i = n > 0 ? n : -n; 1161 register int i = n > 0 ? n : -n;
1165 register char *buf; 1162 register char *buf;
@@ -1170,7 +1167,7 @@ ins_del_lines (vpos, n)
1170 return; 1167 return;
1171 } 1168 }
1172 1169
1173 sf = XFRAME (selected_frame); 1170 f = (updating_frame ? updating_frame : XFRAME (selected_frame));
1174 1171
1175 /* If the lines below the insertion are being pushed 1172 /* If the lines below the insertion are being pushed
1176 into the end of the window, this is the same as clearing; 1173 into the end of the window, this is the same as clearing;
@@ -1179,11 +1176,11 @@ ins_del_lines (vpos, n)
1179 /* If the lines below the deletion are blank lines coming 1176 /* If the lines below the deletion are blank lines coming
1180 out of the end of the window, don't bother, 1177 out of the end of the window, don't bother,
1181 as there will be a matching inslines later that will flush them. */ 1178 as there will be a matching inslines later that will flush them. */
1182 if (TTY_SCROLL_REGION_OK (FRAME_TTY (sf)) 1179 if (TTY_SCROLL_REGION_OK (FRAME_TTY (f))
1183 && vpos + i >= specified_window) 1180 && vpos + i >= specified_window)
1184 return; 1181 return;
1185 if (!TTY_MEMORY_BELOW_FRAME (FRAME_TTY (sf)) 1182 if (!TTY_MEMORY_BELOW_FRAME (FRAME_TTY (f))
1186 && vpos + i >= FRAME_LINES (sf)) 1183 && vpos + i >= FRAME_LINES (f))
1187 return; 1184 return;
1188 1185
1189 if (multi) 1186 if (multi)
@@ -1191,7 +1188,7 @@ ins_del_lines (vpos, n)
1191 raw_cursor_to (vpos, 0); 1188 raw_cursor_to (vpos, 0);
1192 background_highlight (); 1189 background_highlight ();
1193 buf = tparam (multi, 0, 0, i); 1190 buf = tparam (multi, 0, 0, i);
1194 OUTPUT (FRAME_TTY (sf), buf); 1191 OUTPUT (FRAME_TTY (f), buf);
1195 xfree (buf); 1192 xfree (buf);
1196 } 1193 }
1197 else if (single) 1194 else if (single)
@@ -1199,7 +1196,7 @@ ins_del_lines (vpos, n)
1199 raw_cursor_to (vpos, 0); 1196 raw_cursor_to (vpos, 0);
1200 background_highlight (); 1197 background_highlight ();
1201 while (--i >= 0) 1198 while (--i >= 0)
1202 OUTPUT (FRAME_TTY (sf), single); 1199 OUTPUT (FRAME_TTY (f), single);
1203 if (TF_teleray) 1200 if (TF_teleray)
1204 curX = 0; 1201 curX = 0;
1205 } 1202 }
@@ -1212,15 +1209,15 @@ ins_del_lines (vpos, n)
1212 raw_cursor_to (vpos, 0); 1209 raw_cursor_to (vpos, 0);
1213 background_highlight (); 1210 background_highlight ();
1214 while (--i >= 0) 1211 while (--i >= 0)
1215 OUTPUTL (FRAME_TTY (sf), scroll, specified_window - vpos); 1212 OUTPUTL (FRAME_TTY (f), scroll, specified_window - vpos);
1216 set_scroll_region (0, specified_window); 1213 set_scroll_region (0, specified_window);
1217 } 1214 }
1218 1215
1219 if (!TTY_SCROLL_REGION_OK (FRAME_TTY (sf)) 1216 if (!TTY_SCROLL_REGION_OK (FRAME_TTY (f))
1220 && TTY_MEMORY_BELOW_FRAME (FRAME_TTY (sf)) 1217 && TTY_MEMORY_BELOW_FRAME (FRAME_TTY (f))
1221 && n < 0) 1218 && n < 0)
1222 { 1219 {
1223 cursor_to (FRAME_LINES (sf) + n, 0); 1220 cursor_to (FRAME_LINES (f) + n, 0);
1224 clear_to_end (); 1221 clear_to_end ();
1225 } 1222 }
1226} 1223}
@@ -2475,7 +2472,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2475 /* Get frame size from system, or else from termcap. */ 2472 /* Get frame size from system, or else from termcap. */
2476 { 2473 {
2477 int height, width; 2474 int height, width;
2478 get_frame_size (&width, &height); 2475 get_tty_size (tty, &width, &height);
2479 FRAME_COLS (sf) = width; 2476 FRAME_COLS (sf) = width;
2480 FRAME_LINES (sf) = height; 2477 FRAME_LINES (sf) = height;
2481 } 2478 }