76 |
tputs (a, (int) (FRAME_HEIGHT (XFRAME (selected_frame)) \ |
tputs (a, (int) (FRAME_HEIGHT (XFRAME (selected_frame)) \ |
77 |
- curY), cmputc); \ |
- curY), cmputc); \ |
78 |
} while (0) |
} while (0) |
79 |
|
|
80 |
#define OUTPUT1_IF(a) do { if (a) tputs (a, 1, cmputc); } while (0) |
#define OUTPUT1_IF(a) do { if (a) tputs (a, 1, cmputc); } while (0) |
81 |
|
|
82 |
/* Function to use to ring the bell. */ |
/* Function to use to ring the bell. */ |
203 |
|
|
204 |
/* Arrange for all scroll bars on FRAME to be removed at the next call |
/* Arrange for all scroll bars on FRAME to be removed at the next call |
205 |
to `*judge_scroll_bars_hook'. A scroll bar may be spared if |
to `*judge_scroll_bars_hook'. A scroll bar may be spared if |
206 |
`*redeem_scroll_bar_hook' is applied to its window before the judgment. |
`*redeem_scroll_bar_hook' is applied to its window before the judgment. |
207 |
|
|
208 |
This should be applied to each frame each time its window tree is |
This should be applied to each frame each time its window tree is |
209 |
redisplayed, even if it is not displaying scroll bars at the moment; |
redisplayed, even if it is not displaying scroll bars at the moment; |
222 |
void (*redeem_scroll_bar_hook) P_ ((struct window *window)); |
void (*redeem_scroll_bar_hook) P_ ((struct window *window)); |
223 |
|
|
224 |
/* Remove all scroll bars on FRAME that haven't been saved since the |
/* Remove all scroll bars on FRAME that haven't been saved since the |
225 |
last call to `*condemn_scroll_bars_hook'. |
last call to `*condemn_scroll_bars_hook'. |
226 |
|
|
227 |
This should be applied to each frame after each time its window |
This should be applied to each frame after each time its window |
228 |
tree is redisplayed, even if it is not displaying scroll bars at the |
tree is redisplayed, even if it is not displaying scroll bars at the |
235 |
|
|
236 |
void (*judge_scroll_bars_hook) P_ ((FRAME_PTR FRAME)); |
void (*judge_scroll_bars_hook) P_ ((FRAME_PTR FRAME)); |
237 |
|
|
|
/* Hook to call in estimate_mode_line_height, if any. */ |
|
|
|
|
|
int (* estimate_mode_line_height_hook) P_ ((struct frame *f, enum face_id)); |
|
|
|
|
|
|
|
238 |
/* Strings, numbers and flags taken from the termcap entry. */ |
/* Strings, numbers and flags taken from the termcap entry. */ |
239 |
|
|
240 |
char *TS_ins_line; /* "al" */ |
char *TS_ins_line; /* "al" */ |
369 |
|
|
370 |
int max_frame_height; |
int max_frame_height; |
371 |
|
|
372 |
int costs_set = 0; /* Nonzero if costs have been calculated. */ |
static int costs_set; /* Nonzero if costs have been calculated. */ |
373 |
|
|
374 |
int insert_mode; /* Nonzero when in insert mode. */ |
int insert_mode; /* Nonzero when in insert mode. */ |
375 |
int standout_mode; /* Nonzero when in standout mode. */ |
int standout_mode; /* Nonzero when in standout mode. */ |
426 |
We don't specbind it, because that would carefully |
We don't specbind it, because that would carefully |
427 |
restore the bad value if there's an error |
restore the bad value if there's an error |
428 |
and make the loop of errors happen anyway. */ |
and make the loop of errors happen anyway. */ |
429 |
|
|
430 |
function = Vring_bell_function; |
function = Vring_bell_function; |
431 |
Vring_bell_function = Qnil; |
Vring_bell_function = Qnil; |
432 |
|
|
494 |
} |
} |
495 |
else |
else |
496 |
update_end_hook (f); |
update_end_hook (f); |
497 |
|
|
498 |
updating_frame = NULL; |
updating_frame = NULL; |
499 |
} |
} |
500 |
|
|
518 |
{ |
{ |
519 |
char *buf; |
char *buf; |
520 |
struct frame *sf = XFRAME (selected_frame); |
struct frame *sf = XFRAME (selected_frame); |
521 |
|
|
522 |
if (TS_set_scroll_region) |
if (TS_set_scroll_region) |
523 |
buf = tparam (TS_set_scroll_region, 0, 0, start, stop - 1); |
buf = tparam (TS_set_scroll_region, 0, 0, start, stop - 1); |
524 |
else if (TS_set_scroll_region_1) |
else if (TS_set_scroll_region_1) |
528 |
FRAME_HEIGHT (sf)); |
FRAME_HEIGHT (sf)); |
529 |
else |
else |
530 |
buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_WIDTH (sf)); |
buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_WIDTH (sf)); |
531 |
|
|
532 |
OUTPUT (buf); |
OUTPUT (buf); |
533 |
xfree (buf); |
xfree (buf); |
534 |
losecursor (); |
losecursor (); |
639 |
int vpos, hpos; |
int vpos, hpos; |
640 |
{ |
{ |
641 |
struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame); |
struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame); |
642 |
|
|
643 |
if (! FRAME_TERMCAP_P (f) && cursor_to_hook) |
if (! FRAME_TERMCAP_P (f) && cursor_to_hook) |
644 |
{ |
{ |
645 |
(*cursor_to_hook) (vpos, hpos); |
(*cursor_to_hook) (vpos, hpos); |
715 |
clear_frame () |
clear_frame () |
716 |
{ |
{ |
717 |
struct frame *sf = XFRAME (selected_frame); |
struct frame *sf = XFRAME (selected_frame); |
718 |
|
|
719 |
if (clear_frame_hook |
if (clear_frame_hook |
720 |
&& ! FRAME_TERMCAP_P ((updating_frame ? updating_frame : sf))) |
&& ! FRAME_TERMCAP_P ((updating_frame ? updating_frame : sf))) |
721 |
{ |
{ |
805 |
struct glyph *src_start = src, *src_end = src + src_len; |
struct glyph *src_start = src, *src_end = src + src_len; |
806 |
unsigned char *dst_start = dst, *dst_end = dst + dst_len; |
unsigned char *dst_start = dst, *dst_end = dst + dst_len; |
807 |
register GLYPH g; |
register GLYPH g; |
808 |
unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *buf; |
unsigned char workbuf[MAX_MULTIBYTE_LENGTH]; |
809 |
|
const unsigned char *buf; |
810 |
int len; |
int len; |
811 |
register int tlen = GLYPH_TABLE_LENGTH; |
register int tlen = GLYPH_TABLE_LENGTH; |
812 |
register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
867 |
coding->src_multibyte = STRING_MULTIBYTE (tbase[g]); |
coding->src_multibyte = STRING_MULTIBYTE (tbase[g]); |
868 |
} |
} |
869 |
} |
} |
870 |
|
|
871 |
result = encode_coding (coding, buf, dst, len, dst_end - dst); |
result = encode_coding (coding, buf, dst, len, dst_end - dst); |
872 |
len -= coding->consumed; |
len -= coding->consumed; |
873 |
dst += coding->produced; |
dst += coding->produced; |
890 |
} |
} |
891 |
src++; |
src++; |
892 |
} |
} |
893 |
|
|
894 |
*consumed = src - src_start; |
*consumed = src - src_start; |
895 |
return (dst - dst_start); |
return (dst - dst_start); |
896 |
} |
} |
928 |
return; |
return; |
929 |
|
|
930 |
cmplus (len); |
cmplus (len); |
931 |
|
|
932 |
/* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at |
/* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at |
933 |
the tail. */ |
the tail. */ |
934 |
terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; |
terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; |
935 |
|
|
936 |
while (len > 0) |
while (len > 0) |
937 |
{ |
{ |
938 |
/* Identify a run of glyphs with the same face. */ |
/* Identify a run of glyphs with the same face. */ |
939 |
int face_id = string->face_id; |
int face_id = string->face_id; |
940 |
int n; |
int n; |
941 |
|
|
942 |
for (n = 1; n < len; ++n) |
for (n = 1; n < len; ++n) |
943 |
if (string[n].face_id != face_id) |
if (string[n].face_id != face_id) |
944 |
break; |
break; |
972 |
turn_off_face (f, face_id); |
turn_off_face (f, face_id); |
973 |
turn_off_highlight (); |
turn_off_highlight (); |
974 |
} |
} |
975 |
|
|
976 |
/* We may have to output some codes to terminate the writing. */ |
/* We may have to output some codes to terminate the writing. */ |
977 |
if (CODING_REQUIRE_FLUSHING (&terminal_coding)) |
if (CODING_REQUIRE_FLUSHING (&terminal_coding)) |
978 |
{ |
{ |
989 |
termscript); |
termscript); |
990 |
} |
} |
991 |
} |
} |
992 |
|
|
993 |
cmcheckmagic (); |
cmcheckmagic (); |
994 |
} |
} |
995 |
|
|
996 |
/* If start is zero, insert blanks instead of a string at start */ |
/* If start is zero, insert blanks instead of a string at start */ |
997 |
|
|
998 |
void |
void |
999 |
insert_glyphs (start, len) |
insert_glyphs (start, len) |
1000 |
register struct glyph *start; |
register struct glyph *start; |
1082 |
turn_off_highlight (); |
turn_off_highlight (); |
1083 |
} |
} |
1084 |
} |
} |
1085 |
|
|
1086 |
cmcheckmagic (); |
cmcheckmagic (); |
1087 |
} |
} |
1088 |
|
|
1143 |
} |
} |
1144 |
|
|
1145 |
sf = XFRAME (selected_frame); |
sf = XFRAME (selected_frame); |
1146 |
|
|
1147 |
/* If the lines below the insertion are being pushed |
/* If the lines below the insertion are being pushed |
1148 |
into the end of the window, this is the same as clearing; |
into the end of the window, this is the same as clearing; |
1149 |
and we know the lines are already clear, since the matching |
and we know the lines are already clear, since the matching |
1457 |
static Lisp_Object term_get_fkeys_1 (); |
static Lisp_Object term_get_fkeys_1 (); |
1458 |
|
|
1459 |
/* Find the escape codes sent by the function keys for Vfunction_key_map. |
/* Find the escape codes sent by the function keys for Vfunction_key_map. |
1460 |
This function scans the termcap function key sequence entries, and |
This function scans the termcap function key sequence entries, and |
1461 |
adds entries to Vfunction_key_map for each function key it finds. */ |
adds entries to Vfunction_key_map for each function key it finds. */ |
1462 |
|
|
1463 |
void |
void |
1562 |
Fmake_vector (make_number (1), \ |
Fmake_vector (make_number (1), \ |
1563 |
intern (sym))); \ |
intern (sym))); \ |
1564 |
} |
} |
1565 |
|
|
1566 |
/* if there's no key_next keycap, map key_npage to `next' keysym */ |
/* if there's no key_next keycap, map key_npage to `next' keysym */ |
1567 |
CONDITIONAL_REASSIGN ("%5", "kN", "next"); |
CONDITIONAL_REASSIGN ("%5", "kN", "next"); |
1568 |
/* if there's no key_prev keycap, map key_ppage to `previous' keysym */ |
/* if there's no key_prev keycap, map key_ppage to `previous' keysym */ |
1602 |
for which to produce glyphs; IT->face_id contains the character's |
for which to produce glyphs; IT->face_id contains the character's |
1603 |
face. Padding glyphs are appended if IT->c has a IT->pixel_width > |
face. Padding glyphs are appended if IT->c has a IT->pixel_width > |
1604 |
1. */ |
1. */ |
1605 |
|
|
1606 |
static void |
static void |
1607 |
append_glyph (it) |
append_glyph (it) |
1608 |
struct it *it; |
struct it *it; |
1615 |
+ it->glyph_row->used[it->area]); |
+ it->glyph_row->used[it->area]); |
1616 |
end = it->glyph_row->glyphs[1 + it->area]; |
end = it->glyph_row->glyphs[1 + it->area]; |
1617 |
|
|
1618 |
for (i = 0; |
for (i = 0; |
1619 |
i < it->pixel_width && glyph < end; |
i < it->pixel_width && glyph < end; |
1620 |
++i) |
++i) |
1621 |
{ |
{ |
1622 |
glyph->type = CHAR_GLYPH; |
glyph->type = CHAR_GLYPH; |
1626 |
glyph->padding_p = i > 0; |
glyph->padding_p = i > 0; |
1627 |
glyph->charpos = CHARPOS (it->position); |
glyph->charpos = CHARPOS (it->position); |
1628 |
glyph->object = it->object; |
glyph->object = it->object; |
1629 |
|
|
1630 |
++it->glyph_row->used[it->area]; |
++it->glyph_row->used[it->area]; |
1631 |
++glyph; |
++glyph; |
1632 |
} |
} |
1651 |
Callers usually don't call produce_glyphs directly; |
Callers usually don't call produce_glyphs directly; |
1652 |
instead they use the macro PRODUCE_GLYPHS. */ |
instead they use the macro PRODUCE_GLYPHS. */ |
1653 |
|
|
1654 |
void |
void |
1655 |
produce_glyphs (it) |
produce_glyphs (it) |
1656 |
struct it *it; |
struct it *it; |
1657 |
{ |
{ |
1660 |
|| it->what == IT_COMPOSITION |
|| it->what == IT_COMPOSITION |
1661 |
|| it->what == IT_IMAGE |
|| it->what == IT_IMAGE |
1662 |
|| it->what == IT_STRETCH); |
|| it->what == IT_STRETCH); |
1663 |
|
|
1664 |
/* Nothing but characters are supported on terminal frames. For a |
/* Nothing but characters are supported on terminal frames. For a |
1665 |
composition sequence, it->c is the first character of the |
composition sequence, it->c is the first character of the |
1666 |
sequence. */ |
sequence. */ |
1679 |
{ |
{ |
1680 |
int absolute_x = (it->current_x |
int absolute_x = (it->current_x |
1681 |
+ it->continuation_lines_width); |
+ it->continuation_lines_width); |
1682 |
int next_tab_x |
int next_tab_x |
1683 |
= (((1 + absolute_x + it->tab_width - 1) |
= (((1 + absolute_x + it->tab_width - 1) |
1684 |
/ it->tab_width) |
/ it->tab_width) |
1685 |
* it->tab_width); |
* it->tab_width); |
1686 |
int nspaces; |
int nspaces; |
1691 |
continued line. So, we will get the right number of spaces |
continued line. So, we will get the right number of spaces |
1692 |
here. */ |
here. */ |
1693 |
nspaces = next_tab_x - absolute_x; |
nspaces = next_tab_x - absolute_x; |
1694 |
|
|
1695 |
if (it->glyph_row) |
if (it->glyph_row) |
1696 |
{ |
{ |
1697 |
int n = nspaces; |
int n = nspaces; |
1698 |
|
|
1699 |
it->c = ' '; |
it->c = ' '; |
1700 |
it->pixel_width = it->len = 1; |
it->pixel_width = it->len = 1; |
1701 |
|
|
1702 |
while (n--) |
while (n--) |
1703 |
append_glyph (it); |
append_glyph (it); |
1704 |
|
|
1705 |
it->c = '\t'; |
it->c = '\t'; |
1706 |
} |
} |
1707 |
|
|
1729 |
|
|
1730 |
it->pixel_width = CHARSET_WIDTH (charset); |
it->pixel_width = CHARSET_WIDTH (charset); |
1731 |
it->nglyphs = it->pixel_width; |
it->nglyphs = it->pixel_width; |
1732 |
|
|
1733 |
if (it->glyph_row) |
if (it->glyph_row) |
1734 |
append_glyph (it); |
append_glyph (it); |
1735 |
} |
} |
1736 |
|
|
1737 |
/* Advance current_x by the pixel width as a convenience for |
/* Advance current_x by the pixel width as a convenience for |
1738 |
the caller. */ |
the caller. */ |
1739 |
if (it->area == TEXT_AREA) |
if (it->area == TEXT_AREA) |
1740 |
it->current_x += it->pixel_width; |
it->current_x += it->pixel_width; |
1755 |
enum display_element_type what; |
enum display_element_type what; |
1756 |
{ |
{ |
1757 |
struct it temp_it; |
struct it temp_it; |
1758 |
|
|
1759 |
temp_it = *it; |
temp_it = *it; |
1760 |
temp_it.dp = NULL; |
temp_it.dp = NULL; |
1761 |
temp_it.what = IT_CHARACTER; |
temp_it.what = IT_CHARACTER; |
1775 |
} |
} |
1776 |
else |
else |
1777 |
temp_it.c = '\\'; |
temp_it.c = '\\'; |
1778 |
|
|
1779 |
produce_glyphs (&temp_it); |
produce_glyphs (&temp_it); |
1780 |
it->pixel_width = temp_it.pixel_width; |
it->pixel_width = temp_it.pixel_width; |
1781 |
it->nglyphs = temp_it.pixel_width; |
it->nglyphs = temp_it.pixel_width; |
1792 |
} |
} |
1793 |
else |
else |
1794 |
temp_it.c = '$'; |
temp_it.c = '$'; |
1795 |
|
|
1796 |
produce_glyphs (&temp_it); |
produce_glyphs (&temp_it); |
1797 |
it->pixel_width = temp_it.pixel_width; |
it->pixel_width = temp_it.pixel_width; |
1798 |
it->nglyphs = temp_it.pixel_width; |
it->nglyphs = temp_it.pixel_width; |
1802 |
} |
} |
1803 |
|
|
1804 |
|
|
|
/* Return an estimation of the pixel height of mode or top lines on |
|
|
frame F. FACE_ID specifies what line's height to estimate. */ |
|
|
|
|
|
int |
|
|
estimate_mode_line_height (f, face_id) |
|
|
struct frame *f; |
|
|
enum face_id face_id; |
|
|
{ |
|
|
if (estimate_mode_line_height_hook) |
|
|
return estimate_mode_line_height_hook (f, face_id); |
|
|
else |
|
|
return 1; |
|
|
} |
|
|
|
|
|
|
|
1805 |
|
|
1806 |
/*********************************************************************** |
/*********************************************************************** |
1807 |
Faces |
Faces |
1898 |
if (TN_max_colors > 0) |
if (TN_max_colors > 0) |
1899 |
{ |
{ |
1900 |
char *p; |
char *p; |
1901 |
|
|
1902 |
if (fg >= 0 && TS_set_foreground) |
if (fg >= 0 && TS_set_foreground) |
1903 |
{ |
{ |
1904 |
p = tparam (TS_set_foreground, NULL, 0, (int) fg); |
p = tparam (TS_set_foreground, NULL, 0, (int) fg); |
1914 |
} |
} |
1915 |
} |
} |
1916 |
} |
} |
1917 |
|
|
1918 |
|
|
1919 |
/* Turn off appearances of face FACE_ID on tty frame F. */ |
/* Turn off appearances of face FACE_ID on tty frame F. */ |
1920 |
|
|
1966 |
&& face->background != FACE_TTY_DEFAULT_BG_COLOR))) |
&& face->background != FACE_TTY_DEFAULT_BG_COLOR))) |
1967 |
OUTPUT1_IF (TS_orig_pair); |
OUTPUT1_IF (TS_orig_pair); |
1968 |
} |
} |
1969 |
|
|
1970 |
|
|
1971 |
/* Return non-zero if the terminal on frame F supports all of the |
/* Return non-zero if the terminal on frame F supports all of the |
1972 |
capabilities in CAPS simultaneously, with foreground and background |
capabilities in CAPS simultaneously, with foreground and background |
1973 |
colors FG and BG. */ |
colors FG and BG. */ |
2296 |
TS_cursor_visible = tgetstr ("vs", address); |
TS_cursor_visible = tgetstr ("vs", address); |
2297 |
TS_cursor_invisible = tgetstr ("vi", address); |
TS_cursor_invisible = tgetstr ("vi", address); |
2298 |
TS_set_window = tgetstr ("wi", address); |
TS_set_window = tgetstr ("wi", address); |
2299 |
|
|
2300 |
TS_enter_underline_mode = tgetstr ("us", address); |
TS_enter_underline_mode = tgetstr ("us", address); |
2301 |
TS_exit_underline_mode = tgetstr ("ue", address); |
TS_exit_underline_mode = tgetstr ("ue", address); |
2302 |
TS_enter_bold_mode = tgetstr ("md", address); |
TS_enter_bold_mode = tgetstr ("md", address); |
2306 |
TS_enter_alt_charset_mode = tgetstr ("as", address); |
TS_enter_alt_charset_mode = tgetstr ("as", address); |
2307 |
TS_exit_alt_charset_mode = tgetstr ("ae", address); |
TS_exit_alt_charset_mode = tgetstr ("ae", address); |
2308 |
TS_exit_attribute_mode = tgetstr ("me", address); |
TS_exit_attribute_mode = tgetstr ("me", address); |
2309 |
|
|
2310 |
MultiUp = tgetstr ("UP", address); |
MultiUp = tgetstr ("UP", address); |
2311 |
MultiDown = tgetstr ("DO", address); |
MultiDown = tgetstr ("DO", address); |
2312 |
MultiLeft = tgetstr ("LE", address); |
MultiLeft = tgetstr ("LE", address); |
2326 |
TS_set_foreground = tgetstr ("Sf", address); |
TS_set_foreground = tgetstr ("Sf", address); |
2327 |
TS_set_background = tgetstr ("Sb", address); |
TS_set_background = tgetstr ("Sb", address); |
2328 |
} |
} |
2329 |
|
|
2330 |
TN_max_colors = tgetnum ("Co"); |
TN_max_colors = tgetnum ("Co"); |
2331 |
TN_max_pairs = tgetnum ("pa"); |
TN_max_pairs = tgetnum ("pa"); |
2332 |
|
|
2333 |
TN_no_color_video = tgetnum ("NC"); |
TN_no_color_video = tgetnum ("NC"); |
2334 |
if (TN_no_color_video == -1) |
if (TN_no_color_video == -1) |
2335 |
TN_no_color_video = 0; |
TN_no_color_video = 0; |
2367 |
SET_FRAME_WIDTH (sf, FRAME_WIDTH (sf)); |
SET_FRAME_WIDTH (sf, FRAME_WIDTH (sf)); |
2368 |
if (FRAME_HEIGHT (sf) <= 0) |
if (FRAME_HEIGHT (sf) <= 0) |
2369 |
FRAME_HEIGHT (sf) = tgetnum ("li"); |
FRAME_HEIGHT (sf) = tgetnum ("li"); |
2370 |
|
|
2371 |
if (FRAME_HEIGHT (sf) < 3 || FRAME_WIDTH (sf) < 3) |
if (FRAME_HEIGHT (sf) < 3 || FRAME_WIDTH (sf) < 3) |
2372 |
fatal ("Screen size %dx%d is too small", |
fatal ("Screen size %dx%d is too small", |
2373 |
FRAME_HEIGHT (sf), FRAME_WIDTH (sf)); |
FRAME_HEIGHT (sf), FRAME_WIDTH (sf)); |
2394 |
|
|
2395 |
if (TabWidth < 0) |
if (TabWidth < 0) |
2396 |
TabWidth = 8; |
TabWidth = 8; |
2397 |
|
|
2398 |
/* Turned off since /etc/termcap seems to have :ta= for most terminals |
/* Turned off since /etc/termcap seems to have :ta= for most terminals |
2399 |
and newer termcap doc does not seem to say there is a default. |
and newer termcap doc does not seem to say there is a default. |
2400 |
if (!Wcm.cm_tab) |
if (!Wcm.cm_tab) |