diff options
| author | Miles Bader | 2001-10-20 05:53:04 +0000 |
|---|---|---|
| committer | Miles Bader | 2001-10-20 05:53:04 +0000 |
| commit | 8ede64a55f46f793a235d4c8e165878b17e1c72b (patch) | |
| tree | 11c62c54d6ccaadaa956dceec38292cac05f5be9 /src | |
| parent | dd70d37f4007af840d1a9fa7282497b1a53a84f2 (diff) | |
| download | emacs-8ede64a55f46f793a235d4c8e165878b17e1c72b.tar.gz emacs-8ede64a55f46f793a235d4c8e165878b17e1c72b.zip | |
(reassert_line_highlight_hook, change_line_highlight_hook): Variables removed.
(reassert_line_highlight, change_line_highlight): Functions removed.
(standout_requested): Variable removed.
(update_end, highlight_if_desired): Don't use it.
(chars_wasted, copybuf): Variables removed.
(write_standout_marker): Function removed.
(cursor_to, clear_to_end, clear_frame, clear_end_of_line_raw)
(clear_end_of_line_raw, write_glyphs, ins_del_lines):
Don't use `chars_wasted' or `copybuf'.
(calculate_costs): Don't allocate `chars_wasted' or `copybuf'.
Set `costs_set' to true.
(cursor_to, clear_end_of_line): Test `costs_set' instead of `chars_wasted'.
(clear_end_of_line): Function removed.
(clear_end_of_line_raw): Renamed to `clear_end_of_line'.
(clear_to_end): Call `clear_end_of_line' instead of `clear_end_of_line_raw'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 178 |
1 files changed, 11 insertions, 167 deletions
diff --git a/src/term.c b/src/term.c index 65d0c8cedac..dc75820bde8 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -118,9 +118,6 @@ void (*clear_end_of_line_hook) P_ ((int)); | |||
| 118 | 118 | ||
| 119 | void (*ins_del_lines_hook) P_ ((int, int)); | 119 | void (*ins_del_lines_hook) P_ ((int, int)); |
| 120 | 120 | ||
| 121 | void (*change_line_highlight_hook) P_ ((int, int, int, int)); | ||
| 122 | void (*reassert_line_highlight_hook) P_ ((int, int)); | ||
| 123 | |||
| 124 | void (*delete_glyphs_hook) P_ ((int)); | 121 | void (*delete_glyphs_hook) P_ ((int)); |
| 125 | 122 | ||
| 126 | void (*ring_bell_hook) P_ ((void)); | 123 | void (*ring_bell_hook) P_ ((void)); |
| @@ -388,18 +385,7 @@ int max_frame_width; | |||
| 388 | 385 | ||
| 389 | int max_frame_height; | 386 | int max_frame_height; |
| 390 | 387 | ||
| 391 | /* Number of chars of space used for standout marker at beginning of line, | 388 | int costs_set = 0; /* Nonzero if costs have been calculated. */ |
| 392 | or'd with 0100. Zero if no standout marker at all. | ||
| 393 | The length of these vectors is max_frame_height. | ||
| 394 | |||
| 395 | Used IFF TN_standout_width >= 0. */ | ||
| 396 | |||
| 397 | static char *chars_wasted; | ||
| 398 | static char *copybuf; | ||
| 399 | |||
| 400 | /* nonzero means supposed to write text in standout mode. */ | ||
| 401 | |||
| 402 | int standout_requested; | ||
| 403 | 389 | ||
| 404 | int insert_mode; /* Nonzero when in insert mode. */ | 390 | int insert_mode; /* Nonzero when in insert mode. */ |
| 405 | int standout_mode; /* Nonzero when in standout mode. */ | 391 | int standout_mode; /* Nonzero when in standout mode. */ |
| @@ -527,7 +513,6 @@ update_end (f) | |||
| 527 | tty_show_cursor (); | 513 | tty_show_cursor (); |
| 528 | turn_off_insert (); | 514 | turn_off_insert (); |
| 529 | background_highlight (); | 515 | background_highlight (); |
| 530 | standout_requested = 0; | ||
| 531 | } | 516 | } |
| 532 | else | 517 | else |
| 533 | update_end_hook (f); | 518 | update_end_hook (f); |
| @@ -676,97 +661,10 @@ highlight_if_desired () | |||
| 676 | { | 661 | { |
| 677 | if (TN_standout_width >= 0) | 662 | if (TN_standout_width >= 0) |
| 678 | return; | 663 | return; |
| 679 | if (!inverse_video == !standout_requested) | 664 | if (inverse_video) |
| 680 | turn_off_highlight (); | ||
| 681 | else | ||
| 682 | turn_on_highlight (); | 665 | turn_on_highlight (); |
| 683 | } | 666 | else |
| 684 | 667 | turn_off_highlight (); | |
| 685 | /* Handle standout mode for terminals in which TN_standout_width >= 0. | ||
| 686 | On these terminals, standout is controlled by markers that | ||
| 687 | live inside the terminal's memory. TN_standout_width is the width | ||
| 688 | that the marker occupies in memory. Standout runs from the marker | ||
| 689 | to the end of the line on some terminals, or to the next | ||
| 690 | turn-off-standout marker (TS_end_standout_mode) string | ||
| 691 | on other terminals. */ | ||
| 692 | |||
| 693 | /* Write a standout marker or end-standout marker at the front of the line | ||
| 694 | at vertical position vpos. */ | ||
| 695 | |||
| 696 | static void | ||
| 697 | write_standout_marker (flag, vpos) | ||
| 698 | int flag, vpos; | ||
| 699 | { | ||
| 700 | if (flag | ||
| 701 | || (TS_end_standout_mode && !TF_teleray && !se_is_so | ||
| 702 | && !(TF_xs && TN_standout_width == 0))) | ||
| 703 | { | ||
| 704 | cmgoto (vpos, 0); | ||
| 705 | cmplus (TN_standout_width); | ||
| 706 | OUTPUT (flag ? TS_standout_mode : TS_end_standout_mode); | ||
| 707 | chars_wasted[curY] = TN_standout_width | 0100; | ||
| 708 | } | ||
| 709 | } | ||
| 710 | |||
| 711 | /* External interface to control of standout mode. | ||
| 712 | Call this when about to modify line at position VPOS | ||
| 713 | and not change whether it is highlighted. */ | ||
| 714 | |||
| 715 | void | ||
| 716 | reassert_line_highlight (highlight, vpos) | ||
| 717 | int highlight; | ||
| 718 | int vpos; | ||
| 719 | { | ||
| 720 | struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame); | ||
| 721 | if (! FRAME_TERMCAP_P (f)) | ||
| 722 | { | ||
| 723 | (*reassert_line_highlight_hook) (highlight, vpos); | ||
| 724 | return; | ||
| 725 | } | ||
| 726 | if (TN_standout_width < 0) | ||
| 727 | /* Handle terminals where standout takes affect at output time */ | ||
| 728 | standout_requested = highlight; | ||
| 729 | else if (chars_wasted && chars_wasted[vpos] == 0) | ||
| 730 | /* For terminals with standout markers, write one on this line | ||
| 731 | if there isn't one already. */ | ||
| 732 | write_standout_marker (inverse_video ? !highlight : highlight, vpos); | ||
| 733 | } | ||
| 734 | |||
| 735 | /* Call this when about to modify line at position VPOS | ||
| 736 | and change whether it is highlighted. */ | ||
| 737 | |||
| 738 | void | ||
| 739 | change_line_highlight (new_highlight, vpos, y, first_unused_hpos) | ||
| 740 | int new_highlight, vpos, y, first_unused_hpos; | ||
| 741 | { | ||
| 742 | standout_requested = new_highlight; | ||
| 743 | if (! FRAME_TERMCAP_P (updating_frame)) | ||
| 744 | { | ||
| 745 | (*change_line_highlight_hook) (new_highlight, vpos, y, first_unused_hpos); | ||
| 746 | return; | ||
| 747 | } | ||
| 748 | |||
| 749 | cursor_to (vpos, 0); | ||
| 750 | |||
| 751 | if (TN_standout_width < 0) | ||
| 752 | background_highlight (); | ||
| 753 | /* If line starts with a marker, delete the marker */ | ||
| 754 | else if (TS_clr_line && chars_wasted[curY]) | ||
| 755 | { | ||
| 756 | turn_off_insert (); | ||
| 757 | /* On Teleray, make sure to erase the SO marker. */ | ||
| 758 | if (TF_teleray) | ||
| 759 | { | ||
| 760 | cmgoto (curY - 1, FRAME_WIDTH (XFRAME (selected_frame)) - 4); | ||
| 761 | OUTPUT ("\033S"); | ||
| 762 | curY++; /* ESC S moves to next line where the TS_standout_mode was */ | ||
| 763 | curX = 0; | ||
| 764 | } | ||
| 765 | else | ||
| 766 | cmgoto (curY, 0); /* reposition to kill standout marker */ | ||
| 767 | } | ||
| 768 | clear_end_of_line_raw (first_unused_hpos); | ||
| 769 | reassert_line_highlight (new_highlight, curY); | ||
| 770 | } | 668 | } |
| 771 | 669 | ||
| 772 | 670 | ||
| @@ -787,10 +685,9 @@ cursor_to (vpos, hpos) | |||
| 787 | 685 | ||
| 788 | /* Detect the case where we are called from reset_sys_modes | 686 | /* Detect the case where we are called from reset_sys_modes |
| 789 | and the costs have never been calculated. Do nothing. */ | 687 | and the costs have never been calculated. Do nothing. */ |
| 790 | if (chars_wasted == 0) | 688 | if (! costs_set) |
| 791 | return; | 689 | return; |
| 792 | 690 | ||
| 793 | hpos += chars_wasted[vpos] & 077; | ||
| 794 | if (curY == vpos && curX == hpos) | 691 | if (curY == vpos && curX == hpos) |
| 795 | return; | 692 | return; |
| 796 | if (!TF_standout_motion) | 693 | if (!TF_standout_motion) |
| @@ -838,15 +735,13 @@ clear_to_end () | |||
| 838 | { | 735 | { |
| 839 | background_highlight (); | 736 | background_highlight (); |
| 840 | OUTPUT (TS_clr_to_bottom); | 737 | OUTPUT (TS_clr_to_bottom); |
| 841 | bzero (chars_wasted + curY, | ||
| 842 | FRAME_HEIGHT (XFRAME (selected_frame)) - curY); | ||
| 843 | } | 738 | } |
| 844 | else | 739 | else |
| 845 | { | 740 | { |
| 846 | for (i = curY; i < FRAME_HEIGHT (XFRAME (selected_frame)); i++) | 741 | for (i = curY; i < FRAME_HEIGHT (XFRAME (selected_frame)); i++) |
| 847 | { | 742 | { |
| 848 | cursor_to (i, 0); | 743 | cursor_to (i, 0); |
| 849 | clear_end_of_line_raw (FRAME_WIDTH (XFRAME (selected_frame))); | 744 | clear_end_of_line (FRAME_WIDTH (XFRAME (selected_frame))); |
| 850 | } | 745 | } |
| 851 | } | 746 | } |
| 852 | } | 747 | } |
| @@ -868,7 +763,6 @@ clear_frame () | |||
| 868 | { | 763 | { |
| 869 | background_highlight (); | 764 | background_highlight (); |
| 870 | OUTPUT (TS_clr_frame); | 765 | OUTPUT (TS_clr_frame); |
| 871 | bzero (chars_wasted, FRAME_HEIGHT (sf)); | ||
| 872 | cmat (0, 0); | 766 | cmat (0, 0); |
| 873 | } | 767 | } |
| 874 | else | 768 | else |
| @@ -878,32 +772,13 @@ clear_frame () | |||
| 878 | } | 772 | } |
| 879 | } | 773 | } |
| 880 | 774 | ||
| 881 | /* Clear to end of line, but do not clear any standout marker. | ||
| 882 | Assumes that the cursor is positioned at a character of real text, | ||
| 883 | which implies it cannot be before a standout marker | ||
| 884 | unless the marker has zero width. | ||
| 885 | |||
| 886 | Note that the cursor may be moved. */ | ||
| 887 | |||
| 888 | void | ||
| 889 | clear_end_of_line (first_unused_hpos) | ||
| 890 | int first_unused_hpos; | ||
| 891 | { | ||
| 892 | if (FRAME_TERMCAP_P (XFRAME (selected_frame)) | ||
| 893 | && chars_wasted != 0 | ||
| 894 | && TN_standout_width == 0 && curX == 0 && chars_wasted[curY] != 0) | ||
| 895 | write_glyphs (&space_glyph, 1); | ||
| 896 | clear_end_of_line_raw (first_unused_hpos); | ||
| 897 | } | ||
| 898 | |||
| 899 | /* Clear from cursor to end of line. | 775 | /* Clear from cursor to end of line. |
| 900 | Assume that the line is already clear starting at column first_unused_hpos. | 776 | Assume that the line is already clear starting at column first_unused_hpos. |
| 901 | If the cursor is at a standout marker, erase the marker. | ||
| 902 | 777 | ||
| 903 | Note that the cursor may be moved, on terminals lacking a `ce' string. */ | 778 | Note that the cursor may be moved, on terminals lacking a `ce' string. */ |
| 904 | 779 | ||
| 905 | void | 780 | void |
| 906 | clear_end_of_line_raw (first_unused_hpos) | 781 | clear_end_of_line (first_unused_hpos) |
| 907 | int first_unused_hpos; | 782 | int first_unused_hpos; |
| 908 | { | 783 | { |
| 909 | register int i; | 784 | register int i; |
| @@ -919,15 +794,11 @@ clear_end_of_line_raw (first_unused_hpos) | |||
| 919 | 794 | ||
| 920 | /* Detect the case where we are called from reset_sys_modes | 795 | /* Detect the case where we are called from reset_sys_modes |
| 921 | and the costs have never been calculated. Do nothing. */ | 796 | and the costs have never been calculated. Do nothing. */ |
| 922 | if (chars_wasted == 0) | 797 | if (! costs_set) |
| 923 | return; | 798 | return; |
| 924 | 799 | ||
| 925 | first_unused_hpos += chars_wasted[curY] & 077; | ||
| 926 | if (curX >= first_unused_hpos) | 800 | if (curX >= first_unused_hpos) |
| 927 | return; | 801 | return; |
| 928 | /* Notice if we are erasing a magic cookie */ | ||
| 929 | if (curX == 0) | ||
| 930 | chars_wasted[curY] = 0; | ||
| 931 | background_highlight (); | 802 | background_highlight (); |
| 932 | if (TS_clr_line) | 803 | if (TS_clr_line) |
| 933 | { | 804 | { |
| @@ -1087,7 +958,7 @@ write_glyphs (string, len) | |||
| 1087 | 958 | ||
| 1088 | if (AutoWrap | 959 | if (AutoWrap |
| 1089 | && curY + 1 == FRAME_HEIGHT (sf) | 960 | && curY + 1 == FRAME_HEIGHT (sf) |
| 1090 | && (curX + len - (chars_wasted[curY] & 077) == FRAME_WIDTH (sf))) | 961 | && (curX + len) == FRAME_WIDTH (sf)) |
| 1091 | len --; | 962 | len --; |
| 1092 | if (len <= 0) | 963 | if (len <= 0) |
| 1093 | return; | 964 | return; |
| @@ -1357,20 +1228,6 @@ ins_del_lines (vpos, n) | |||
| 1357 | = (scroll_region_ok | 1228 | = (scroll_region_ok |
| 1358 | ? specified_window | 1229 | ? specified_window |
| 1359 | : FRAME_HEIGHT (sf)); | 1230 | : FRAME_HEIGHT (sf)); |
| 1360 | |||
| 1361 | if (n < 0) | ||
| 1362 | { | ||
| 1363 | bcopy (&chars_wasted[vpos - n], &chars_wasted[vpos], | ||
| 1364 | lower_limit - vpos + n); | ||
| 1365 | bzero (&chars_wasted[lower_limit + n], - n); | ||
| 1366 | } | ||
| 1367 | else | ||
| 1368 | { | ||
| 1369 | bcopy (&chars_wasted[vpos], ©buf[vpos], lower_limit - vpos - n); | ||
| 1370 | bcopy (©buf[vpos], &chars_wasted[vpos + n], | ||
| 1371 | lower_limit - vpos - n); | ||
| 1372 | bzero (&chars_wasted[vpos], n); | ||
| 1373 | } | ||
| 1374 | } | 1231 | } |
| 1375 | if (!scroll_region_ok && memory_below_frame && n < 0) | 1232 | if (!scroll_region_ok && memory_below_frame && n < 0) |
| 1376 | { | 1233 | { |
| @@ -1509,23 +1366,12 @@ calculate_costs (frame) | |||
| 1509 | once for the terminal frame of X-windows emacs, but not used afterwards. | 1366 | once for the terminal frame of X-windows emacs, but not used afterwards. |
| 1510 | 1367 | ||
| 1511 | char_ins_del_vector (i.e., char_ins_del_cost) isn't used because | 1368 | char_ins_del_vector (i.e., char_ins_del_cost) isn't used because |
| 1512 | X turns off char_ins_del_ok. | 1369 | X turns off char_ins_del_ok. */ |
| 1513 | |||
| 1514 | chars_wasted and copybuf are only used here in term.c in cases where | ||
| 1515 | the term hook isn't called. */ | ||
| 1516 | 1370 | ||
| 1517 | max_frame_height = max (max_frame_height, FRAME_HEIGHT (frame)); | 1371 | max_frame_height = max (max_frame_height, FRAME_HEIGHT (frame)); |
| 1518 | max_frame_width = max (max_frame_width, FRAME_WIDTH (frame)); | 1372 | max_frame_width = max (max_frame_width, FRAME_WIDTH (frame)); |
| 1519 | 1373 | ||
| 1520 | if (chars_wasted != 0) | 1374 | costs_set = 1; |
| 1521 | chars_wasted = (char *) xrealloc (chars_wasted, max_frame_height); | ||
| 1522 | else | ||
| 1523 | chars_wasted = (char *) xmalloc (max_frame_height); | ||
| 1524 | |||
| 1525 | if (copybuf != 0) | ||
| 1526 | copybuf = (char *) xrealloc (copybuf, max_frame_height); | ||
| 1527 | else | ||
| 1528 | copybuf = (char *) xmalloc (max_frame_height); | ||
| 1529 | 1375 | ||
| 1530 | if (char_ins_del_vector != 0) | 1376 | if (char_ins_del_vector != 0) |
| 1531 | char_ins_del_vector | 1377 | char_ins_del_vector |
| @@ -1537,8 +1383,6 @@ calculate_costs (frame) | |||
| 1537 | = (int *) xmalloc (sizeof (int) | 1383 | = (int *) xmalloc (sizeof (int) |
| 1538 | + 2 * max_frame_width * sizeof (int)); | 1384 | + 2 * max_frame_width * sizeof (int)); |
| 1539 | 1385 | ||
| 1540 | bzero (chars_wasted, max_frame_height); | ||
| 1541 | bzero (copybuf, max_frame_height); | ||
| 1542 | bzero (char_ins_del_vector, (sizeof (int) | 1386 | bzero (char_ins_del_vector, (sizeof (int) |
| 1543 | + 2 * max_frame_width * sizeof (int))); | 1387 | + 2 * max_frame_width * sizeof (int))); |
| 1544 | 1388 | ||