aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorJim Blandy1992-08-19 06:38:40 +0000
committerJim Blandy1992-08-19 06:38:40 +0000
commita796ac82a396d99bcb77f00736328a84dce83768 (patch)
tree36a07269eea1adee5377716a443f4e45a5a3b2a1 /src/term.c
parent345677047df477bf523ff915ff91249031c180d1 (diff)
downloademacs-a796ac82a396d99bcb77f00736328a84dce83768.tar.gz
emacs-a796ac82a396d99bcb77f00736328a84dce83768.zip
* term.c (term_get_fkeys): Some systems define `static' to be the
empty string, which means that you can't have constant initialized arrays inside a function. So move the `keys' array outside of the function. * term.c (keys): Include definitions for "K2" (the center key on an IBM keypad), "F1" (F11), and "F2" (F12). Handle "k0" and "k;" specially; see the code for details. * term.c (clear_end_of_line): Remember that on some systems, "static" gets defined to be the null string, so we can't declare an array to be static and then initialize it. Since the array in question (buf) is only one element long, just make it a scalar rather than an array; it can then be initialized, even if it's not static.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c102
1 files changed, 65 insertions, 37 deletions
diff --git a/src/term.c b/src/term.c
index 83d2f118a6e..a5678f3fb7e 100644
--- a/src/term.c
+++ b/src/term.c
@@ -562,10 +562,10 @@ clear_frame ()
562clear_end_of_line (first_unused_hpos) 562clear_end_of_line (first_unused_hpos)
563 int first_unused_hpos; 563 int first_unused_hpos;
564{ 564{
565 static GLYPH buf[1] = {SPACEGLYPH}; 565 static GLYPH buf = SPACEGLYPH;
566 if (FRAME_TERMCAP_P (selected_frame) 566 if (FRAME_TERMCAP_P (selected_frame)
567 && TN_standout_width == 0 && curX == 0 && chars_wasted[curY] != 0) 567 && TN_standout_width == 0 && curX == 0 && chars_wasted[curY] != 0)
568 write_glyphs (buf, 1); 568 write_glyphs (&buf, 1);
569 clear_end_of_line_raw (first_unused_hpos); 569 clear_end_of_line_raw (first_unused_hpos);
570} 570}
571 571
@@ -1064,46 +1064,50 @@ calculate_costs (frame)
1064 This function scans the termcap function key sequence entries, and 1064 This function scans the termcap function key sequence entries, and
1065 adds entries to Vfunction_key_map for each function key it finds. */ 1065 adds entries to Vfunction_key_map for each function key it finds. */
1066 1066
1067struct fkey_table {
1068 char *cap, *name;
1069};
1070
1071static struct fkey_table keys[] = {
1072 "kl", "left",
1073 "kr", "right",
1074 "ku", "up",
1075 "kd", "down",
1076 "K2", "center",
1077 "k1", "f1",
1078 "k2", "f2",
1079 "k3", "f3",
1080 "k4", "f4",
1081 "k5", "f5",
1082 "k6", "f6",
1083 "k7", "f7",
1084 "k8", "f8",
1085 "k9", "f9",
1086 "F1", "f11",
1087 "F2", "f12",
1088 "kh", "home",
1089 "kH", "home-down",
1090 "ka", "clear-tabs",
1091 "kt", "clear-tab",
1092 "kT", "set-tab",
1093 "kC", "clear",
1094 "kL", "deleteline",
1095 "kM", "exit-insert",
1096 "kE", "clear-eol",
1097 "kS", "clear-eos",
1098 "kI", "insert",
1099 "kA", "insertline",
1100 "kN", "next",
1101 "kP", "prior",
1102 "kF", "scroll-forward",
1103 "kR", "scroll-reverse"
1104 };
1105
1067void 1106void
1068term_get_fkeys (address) 1107term_get_fkeys (address)
1069 char **address; 1108 char **address;
1070{ 1109{
1071 extern char *tgetstr (); 1110 extern char *tgetstr ();
1072 struct fkey_table {
1073 char *cap, *name;
1074 };
1075 static struct fkey_table keys[] = {
1076 "kl", "left",
1077 "kr", "right",
1078 "ku", "up",
1079 "kd", "down",
1080 "kh", "home",
1081 "k1", "f1",
1082 "k2", "f2",
1083 "k3", "f3",
1084 "k4", "f4",
1085 "k5", "f5",
1086 "k6", "f6",
1087 "k7", "f7",
1088 "k8", "f8",
1089 "k9", "f9",
1090 "k0", "f10",
1091 "kH", "home-down",
1092 "ka", "clear-tabs",
1093 "kt", "clear-tab",
1094 "kT", "set-tab",
1095 "kC", "clear",
1096 "kL", "deleteline",
1097 "kM", "exit-insert",
1098 "kE", "clear-eol",
1099 "kS", "clear-eos",
1100 "kI", "insert",
1101 "kA", "insertline",
1102 "kN", "next",
1103 "kP", "prior",
1104 "kF", "scroll-forward",
1105 "kR", "scroll-reverse"
1106 };
1107 int i; 1111 int i;
1108 1112
1109 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) 1113 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
@@ -1114,6 +1118,30 @@ term_get_fkeys (address)
1114 build_string (sequence), 1118 build_string (sequence),
1115 Fmake_vector (make_number (1), intern (keys[i].name))); 1119 Fmake_vector (make_number (1), intern (keys[i].name)));
1116 } 1120 }
1121
1122 /* The uses of the "k0" capability are inconsistent; sometimes it
1123 describes F10, whereas othertimes it describes F0 and "k;" describes F10.
1124 We will attempt to politely accomodate both systems by testing for
1125 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
1126 */
1127 {
1128 char *k_semi = tgetstr ("k;", address);
1129 char *k0 = tgetstr ("k0", address);
1130 char *k0_name = "f10";
1131
1132 if (k_semi)
1133 {
1134 Fdefine_key (Vfunction_key_map,
1135 build_string (k_semi),
1136 Fmake_vector (make_number (1), intern ("f10")));
1137 k0_name = "f0";
1138 }
1139
1140 if (k0)
1141 Fdefine_key (Vfunction_key_map,
1142 build_string (k0),
1143 Fmake_vector (make_number (1), intern (k0_name)));
1144 }
1117} 1145}
1118 1146
1119 1147