50338
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2016, the original author or authors.
|
|
3 |
*
|
|
4 |
* This software is distributable under the BSD license. See the terms of the
|
|
5 |
* BSD license in the documentation provided with this software.
|
|
6 |
*
|
|
7 |
* http://www.opensource.org/licenses/bsd-license.php
|
|
8 |
*/
|
|
9 |
package jdk.internal.jline.internal;
|
|
10 |
|
|
11 |
import java.io.IOException;
|
|
12 |
import java.util.Collections;
|
|
13 |
import java.util.HashMap;
|
|
14 |
import java.util.Map;
|
|
15 |
import java.util.Set;
|
|
16 |
import java.util.regex.Matcher;
|
|
17 |
import java.util.regex.Pattern;
|
|
18 |
|
|
19 |
/**
|
|
20 |
* Infocmp helper methods.
|
|
21 |
*
|
|
22 |
* @author <a href="mailto:gnodet@gmail.com">Guillaume Nodet</a>
|
|
23 |
*/
|
|
24 |
public class InfoCmp {
|
|
25 |
|
|
26 |
private static final Map<String, String> CAPS = new HashMap<String, String>();
|
|
27 |
|
|
28 |
public static String getInfoCmp(
|
|
29 |
String terminal
|
|
30 |
) throws IOException, InterruptedException {
|
|
31 |
String caps = CAPS.get(terminal);
|
|
32 |
if (caps == null) {
|
|
33 |
Process p = new ProcessBuilder("infocmp", terminal).start();
|
|
34 |
caps = TerminalLineSettings.waitAndCapture(p);
|
|
35 |
CAPS.put(terminal, caps);
|
|
36 |
}
|
|
37 |
return caps;
|
|
38 |
}
|
|
39 |
|
|
40 |
public static String getAnsiCaps() {
|
|
41 |
return ANSI_CAPS;
|
|
42 |
}
|
|
43 |
|
|
44 |
public static void parseInfoCmp(
|
|
45 |
String capabilities,
|
|
46 |
Set<String> bools,
|
|
47 |
Map<String, Integer> ints,
|
|
48 |
Map<String, String> strings
|
|
49 |
) {
|
|
50 |
String[] lines = capabilities.split("\n");
|
|
51 |
for (int i = 2; i < lines.length; i++) {
|
|
52 |
Matcher m = Pattern.compile("\\s*(([^,]|\\\\,)+)\\s*[,$]").matcher(lines[i]);
|
|
53 |
while (m.find()) {
|
|
54 |
String cap = m.group(1);
|
|
55 |
if (cap.contains("#")) {
|
|
56 |
int index = cap.indexOf('#');
|
|
57 |
String key = cap.substring(0, index);
|
|
58 |
String val = cap.substring(index + 1);
|
|
59 |
int iVal;
|
|
60 |
if (val.startsWith("0x")) {
|
|
61 |
iVal = Integer.parseInt(val.substring(2), 16);
|
|
62 |
} else {
|
|
63 |
iVal = Integer.parseInt(val);
|
|
64 |
}
|
|
65 |
for (String name : getNames(key)) {
|
|
66 |
ints.put(name, iVal);
|
|
67 |
}
|
|
68 |
} else if (cap.contains("=")) {
|
|
69 |
int index = cap.indexOf('=');
|
|
70 |
String key = cap.substring(0, index);
|
|
71 |
String val = cap.substring(index + 1);
|
|
72 |
for (String name : getNames(key)) {
|
|
73 |
strings.put(name, val);
|
|
74 |
}
|
|
75 |
} else {
|
|
76 |
for (String name : getNames(cap)) {
|
|
77 |
bools.add(name);
|
|
78 |
}
|
|
79 |
}
|
|
80 |
}
|
|
81 |
}
|
|
82 |
}
|
|
83 |
|
|
84 |
public static String[] getNames(String name) {
|
|
85 |
String[] names = NAMES.get(name);
|
|
86 |
return names != null ? names : new String[] { name };
|
|
87 |
}
|
|
88 |
|
|
89 |
private static final Map<String, String[]> NAMES;
|
|
90 |
static {
|
|
91 |
String[][] list = {
|
|
92 |
{ "auto_left_margin", "bw", "bw" },
|
|
93 |
{ "auto_right_margin", "am", "am" },
|
|
94 |
{ "back_color_erase", "bce", "ut" },
|
|
95 |
{ "can_change", "ccc", "cc" },
|
|
96 |
{ "ceol_standout_glitch", "xhp", "xs" },
|
|
97 |
{ "col_addr_glitch", "xhpa", "YA" },
|
|
98 |
{ "cpi_changes_res", "cpix", "YF" },
|
|
99 |
{ "cr_cancels_micro_mode", "crxm", "YB" },
|
|
100 |
{ "dest_tabs_magic_smso", "xt", "xt" },
|
|
101 |
{ "eat_newline_glitch", "xenl", "xn" },
|
|
102 |
{ "erase_overstrike", "eo", "eo" },
|
|
103 |
{ "generic_type", "gn", "gn" },
|
|
104 |
{ "hard_copy", "hc", "hc" },
|
|
105 |
{ "hard_cursor", "chts", "HC" },
|
|
106 |
{ "has_meta_key", "km", "km" },
|
|
107 |
{ "has_print_wheel", "daisy", "YC" },
|
|
108 |
{ "has_status_line", "hs", "hs" },
|
|
109 |
{ "hue_lightness_saturation", "hls", "hl" },
|
|
110 |
{ "insert_null_glitch", "in", "in" },
|
|
111 |
{ "lpi_changes_res", "lpix", "YG" },
|
|
112 |
{ "memory_above", "da", "da" },
|
|
113 |
{ "memory_below", "db", "db" },
|
|
114 |
{ "move_insert_mode", "mir", "mi" },
|
|
115 |
{ "move_standout_mode", "msgr", "ms" },
|
|
116 |
{ "needs_xon_xoff", "nxon", "nx" },
|
|
117 |
{ "no_esc_ctlc", "xsb", "xb" },
|
|
118 |
{ "no_pad_char", "npc", "NP" },
|
|
119 |
{ "non_dest_scroll_region", "ndscr", "ND" },
|
|
120 |
{ "non_rev_rmcup", "nrrmc", "NR" },
|
|
121 |
{ "over_strike", "os", "os" },
|
|
122 |
{ "prtr_silent", "mc5i", "5i" },
|
|
123 |
{ "row_addr_glitch", "xvpa", "YD" },
|
|
124 |
{ "semi_auto_right_margin", "sam", "YE" },
|
|
125 |
{ "status_line_esc_ok", "eslok", "es" },
|
|
126 |
{ "tilde_glitch", "hz", "hz" },
|
|
127 |
{ "transparent_underline", "ul", "ul" },
|
|
128 |
{ "xon_xoff", "xon", "xo" },
|
|
129 |
{ "columns", "cols", "co" },
|
|
130 |
{ "init_tabs", "it", "it" },
|
|
131 |
{ "label_height", "lh", "lh" },
|
|
132 |
{ "label_width", "lw", "lw" },
|
|
133 |
{ "lines", "lines", "li" },
|
|
134 |
{ "lines_of_memory", "lm", "lm" },
|
|
135 |
{ "magic_cookie_glitch", "xmc", "sg" },
|
|
136 |
{ "max_attributes", "ma", "ma" },
|
|
137 |
{ "max_colors", "colors", "Co" },
|
|
138 |
{ "max_pairs", "pairs", "pa" },
|
|
139 |
{ "maximum_windows", "wnum", "MW" },
|
|
140 |
{ "no_color_video", "ncv", "NC" },
|
|
141 |
{ "num_labels", "nlab", "Nl" },
|
|
142 |
{ "padding_baud_rate", "pb", "pb" },
|
|
143 |
{ "virtual_terminal", "vt", "vt" },
|
|
144 |
{ "width_status_line", "wsl", "ws" },
|
|
145 |
{ "bit_image_entwining", "bitwin", "Yo" },
|
|
146 |
{ "bit_image_type", "bitype", "Yp" },
|
|
147 |
{ "buffer_capacity", "bufsz", "Ya" },
|
|
148 |
{ "buttons", "btns", "BT" },
|
|
149 |
{ "dot_horz_spacing", "spinh", "Yc" },
|
|
150 |
{ "dot_vert_spacing", "spinv", "Yb" },
|
|
151 |
{ "max_micro_address", "maddr", "Yd" },
|
|
152 |
{ "max_micro_jump", "mjump", "Ye" },
|
|
153 |
{ "micro_col_size", "mcs", "Yf" },
|
|
154 |
{ "micro_line_size", "mls", "Yg" },
|
|
155 |
{ "number_of_pins", "npins", "Yh" },
|
|
156 |
{ "output_res_char", "orc", "Yi" },
|
|
157 |
{ "output_res_horz_inch", "orhi", "Yk" },
|
|
158 |
{ "output_res_line", "orl", "Yj" },
|
|
159 |
{ "output_res_vert_inch", "orvi", "Yl" },
|
|
160 |
{ "print_rate", "cps", "Ym" },
|
|
161 |
{ "wide_char_size", "widcs", "Yn" },
|
|
162 |
{ "acs_chars", "acsc", "ac" },
|
|
163 |
{ "back_tab", "cbt", "bt" },
|
|
164 |
{ "bell", "bel", "bl" },
|
|
165 |
{ "carriage_return", "cr", "cr" },
|
|
166 |
{ "change_char_pitch", "cpi", "ZA" },
|
|
167 |
{ "change_line_pitch", "lpi", "ZB" },
|
|
168 |
{ "change_res_horz", "chr", "ZC" },
|
|
169 |
{ "change_res_vert", "cvr", "ZD" },
|
|
170 |
{ "change_scroll_region", "csr", "cs" },
|
|
171 |
{ "char_padding", "rmp", "rP" },
|
|
172 |
{ "clear_all_tabs", "tbc", "ct" },
|
|
173 |
{ "clear_margins", "mgc", "MC" },
|
|
174 |
{ "clear_screen", "clear", "cl" },
|
|
175 |
{ "clr_bol", "el1", "cb" },
|
|
176 |
{ "clr_eol", "el", "ce" },
|
|
177 |
{ "clr_eos", "ed", "cd" },
|
|
178 |
{ "column_address", "hpa", "ch" },
|
|
179 |
{ "command_character", "cmdch", "CC" },
|
|
180 |
{ "create_window", "cwin", "CW" },
|
|
181 |
{ "cursor_address", "cup", "cm" },
|
|
182 |
{ "cursor_down", "cud1", "do" },
|
|
183 |
{ "cursor_home", "home", "ho" },
|
|
184 |
{ "cursor_invisible", "civis", "vi" },
|
|
185 |
{ "cursor_left", "cub1", "le" },
|
|
186 |
{ "cursor_mem_address", "mrcup", "CM" },
|
|
187 |
{ "cursor_normal", "cnorm", "ve" },
|
|
188 |
{ "cursor_right", "cuf1", "nd" },
|
|
189 |
{ "cursor_to_ll", "ll", "ll" },
|
|
190 |
{ "cursor_up", "cuu1", "up" },
|
|
191 |
{ "cursor_visible", "cvvis", "vs" },
|
|
192 |
{ "define_char", "defc", "ZE" },
|
|
193 |
{ "delete_character", "dch1", "dc" },
|
|
194 |
{ "delete_line", "dl1", "dl" },
|
|
195 |
{ "dial_phone", "dial", "DI" },
|
|
196 |
{ "dis_status_line", "dsl", "ds" },
|
|
197 |
{ "display_clock", "dclk", "DK" },
|
|
198 |
{ "down_half_line", "hd", "hd" },
|
|
199 |
{ "ena_acs", "enacs", "eA" },
|
|
200 |
{ "enter_alt_charset_mode", "smacs", "as" },
|
|
201 |
{ "enter_am_mode", "smam", "SA" },
|
|
202 |
{ "enter_blink_mode", "blink", "mb" },
|
|
203 |
{ "enter_bold_mode", "bold", "md" },
|
|
204 |
{ "enter_ca_mode", "smcup", "ti" },
|
|
205 |
{ "enter_delete_mode", "smdc", "dm" },
|
|
206 |
{ "enter_dim_mode", "dim", "mh" },
|
|
207 |
{ "enter_doublewide_mode", "swidm", "ZF" },
|
|
208 |
{ "enter_draft_quality", "sdrfq", "ZG" },
|
|
209 |
{ "enter_insert_mode", "smir", "im" },
|
|
210 |
{ "enter_italics_mode", "sitm", "ZH" },
|
|
211 |
{ "enter_leftward_mode", "slm", "ZI" },
|
|
212 |
{ "enter_micro_mode", "smicm", "ZJ" },
|
|
213 |
{ "enter_near_letter_quality", "snlq", "ZK" },
|
|
214 |
{ "enter_normal_quality", "snrmq", "ZL" },
|
|
215 |
{ "enter_protected_mode", "prot", "mp" },
|
|
216 |
{ "enter_reverse_mode", "rev", "mr" },
|
|
217 |
{ "enter_secure_mode", "invis", "mk" },
|
|
218 |
{ "enter_shadow_mode", "sshm", "ZM" },
|
|
219 |
{ "enter_standout_mode", "smso", "so" },
|
|
220 |
{ "enter_subscript_mode", "ssubm", "ZN" },
|
|
221 |
{ "enter_superscript_mode", "ssupm", "ZO" },
|
|
222 |
{ "enter_underline_mode", "smul", "us" },
|
|
223 |
{ "enter_upward_mode", "sum", "ZP" },
|
|
224 |
{ "enter_xon_mode", "smxon", "SX" },
|
|
225 |
{ "erase_chars", "ech", "ec" },
|
|
226 |
{ "exit_alt_charset_mode", "rmacs", "ae" },
|
|
227 |
{ "exit_am_mode", "rmam", "RA" },
|
|
228 |
{ "exit_attribute_mode", "sgr0", "me" },
|
|
229 |
{ "exit_ca_mode", "rmcup", "te" },
|
|
230 |
{ "exit_delete_mode", "rmdc", "ed" },
|
|
231 |
{ "exit_doublewide_mode", "rwidm", "ZQ" },
|
|
232 |
{ "exit_insert_mode", "rmir", "ei" },
|
|
233 |
{ "exit_italics_mode", "ritm", "ZR" },
|
|
234 |
{ "exit_leftward_mode", "rlm", "ZS" },
|
|
235 |
{ "exit_micro_mode", "rmicm", "ZT" },
|
|
236 |
{ "exit_shadow_mode", "rshm", "ZU" },
|
|
237 |
{ "exit_standout_mode", "rmso", "se" },
|
|
238 |
{ "exit_subscript_mode", "rsubm", "ZV" },
|
|
239 |
{ "exit_superscript_mode", "rsupm", "ZW" },
|
|
240 |
{ "exit_underline_mode", "rmul", "ue" },
|
|
241 |
{ "exit_upward_mode", "rum", "ZX" },
|
|
242 |
{ "exit_xon_mode", "rmxon", "RX" },
|
|
243 |
{ "fixed_pause", "pause", "PA" },
|
|
244 |
{ "flash_hook", "hook", "fh" },
|
|
245 |
{ "flash_screen", "flash", "vb" },
|
|
246 |
{ "form_feed", "ff", "ff" },
|
|
247 |
{ "from_status_line", "fsl", "fs" },
|
|
248 |
{ "goto_window", "wingo", "WG" },
|
|
249 |
{ "hangup", "hup", "HU" },
|
|
250 |
{ "init_1string", "is1", "i1" },
|
|
251 |
{ "init_2string", "is2", "is" },
|
|
252 |
{ "init_3string", "is3", "i3" },
|
|
253 |
{ "init_file", "if", "if" },
|
|
254 |
{ "init_prog", "iprog", "iP" },
|
|
255 |
{ "initialize_color", "initc", "Ic" },
|
|
256 |
{ "initialize_pair", "initp", "Ip" },
|
|
257 |
{ "insert_character", "ich1", "ic" },
|
|
258 |
{ "insert_line", "il1", "al" },
|
|
259 |
{ "insert_padding", "ip", "ip" },
|
|
260 |
{ "key_a1", "ka1", "K1" },
|
|
261 |
{ "key_a3", "ka3", "K3" },
|
|
262 |
{ "key_b2", "kb2", "K2" },
|
|
263 |
{ "key_backspace", "kbs", "kb" },
|
|
264 |
{ "key_beg", "kbeg", "@1" },
|
|
265 |
{ "key_btab", "kcbt", "kB" },
|
|
266 |
{ "key_c1", "kc1", "K4" },
|
|
267 |
{ "key_c3", "kc3", "K5" },
|
|
268 |
{ "key_cancel", "kcan", "@2" },
|
|
269 |
{ "key_catab", "ktbc", "ka" },
|
|
270 |
{ "key_clear", "kclr", "kC" },
|
|
271 |
{ "key_close", "kclo", "@3" },
|
|
272 |
{ "key_command", "kcmd", "@4" },
|
|
273 |
{ "key_copy", "kcpy", "@5" },
|
|
274 |
{ "key_create", "kcrt", "@6" },
|
|
275 |
{ "key_ctab", "kctab", "kt" },
|
|
276 |
{ "key_dc", "kdch1", "kD" },
|
|
277 |
{ "key_dl", "kdl1", "kL" },
|
|
278 |
{ "key_down", "kcud1", "kd" },
|
|
279 |
{ "key_eic", "krmir", "kM" },
|
|
280 |
{ "key_end", "kend", "@7" },
|
|
281 |
{ "key_enter", "kent", "@8" },
|
|
282 |
{ "key_eol", "kel", "kE" },
|
|
283 |
{ "key_eos", "ked", "kS" },
|
|
284 |
{ "key_exit", "kext", "@9" },
|
|
285 |
{ "key_f0", "kf0", "k0" },
|
|
286 |
{ "key_f1", "kf1", "k1" },
|
|
287 |
{ "key_f10", "kf10", "k;" },
|
|
288 |
{ "key_f11", "kf11", "F1" },
|
|
289 |
{ "key_f12", "kf12", "F2" },
|
|
290 |
{ "key_f13", "kf13", "F3" },
|
|
291 |
{ "key_f14", "kf14", "F4" },
|
|
292 |
{ "key_f15", "kf15", "F5" },
|
|
293 |
{ "key_f16", "kf16", "F6" },
|
|
294 |
{ "key_f17", "kf17", "F7" },
|
|
295 |
{ "key_f18", "kf18", "F8" },
|
|
296 |
{ "key_f19", "kf19", "F9" },
|
|
297 |
{ "key_f2", "kf2", "k2" },
|
|
298 |
{ "key_f20", "kf20", "FA" },
|
|
299 |
{ "key_f21", "kf21", "FB" },
|
|
300 |
{ "key_f22", "kf22", "FC" },
|
|
301 |
{ "key_f23", "kf23", "FD" },
|
|
302 |
{ "key_f24", "kf24", "FE" },
|
|
303 |
{ "key_f25", "kf25", "FF" },
|
|
304 |
{ "key_f26", "kf26", "FG" },
|
|
305 |
{ "key_f27", "kf27", "FH" },
|
|
306 |
{ "key_f28", "kf28", "FI" },
|
|
307 |
{ "key_f29", "kf29", "FJ" },
|
|
308 |
{ "key_f3", "kf3", "k3" },
|
|
309 |
{ "key_f30", "kf30", "FK" },
|
|
310 |
{ "key_f31", "kf31", "FL" },
|
|
311 |
{ "key_f32", "kf32", "FM" },
|
|
312 |
{ "key_f33", "kf33", "FN" },
|
|
313 |
{ "key_f34", "kf34", "FO" },
|
|
314 |
{ "key_f35", "kf35", "FP" },
|
|
315 |
{ "key_f36", "kf36", "FQ" },
|
|
316 |
{ "key_f37", "kf37", "FR" },
|
|
317 |
{ "key_f38", "kf38", "FS" },
|
|
318 |
{ "key_f39", "kf39", "FT" },
|
|
319 |
{ "key_f4", "kf4", "k4" },
|
|
320 |
{ "key_f40", "kf40", "FU" },
|
|
321 |
{ "key_f41", "kf41", "FV" },
|
|
322 |
{ "key_f42", "kf42", "FW" },
|
|
323 |
{ "key_f43", "kf43", "FX" },
|
|
324 |
{ "key_f44", "kf44", "FY" },
|
|
325 |
{ "key_f45", "kf45", "FZ" },
|
|
326 |
{ "key_f46", "kf46", "Fa" },
|
|
327 |
{ "key_f47", "kf47", "Fb" },
|
|
328 |
{ "key_f48", "kf48", "Fc" },
|
|
329 |
{ "key_f49", "kf49", "Fd" },
|
|
330 |
{ "key_f5", "kf5", "k5" },
|
|
331 |
{ "key_f50", "kf50", "Fe" },
|
|
332 |
{ "key_f51", "kf51", "Ff" },
|
|
333 |
{ "key_f52", "kf52", "Fg" },
|
|
334 |
{ "key_f53", "kf53", "Fh" },
|
|
335 |
{ "key_f54", "kf54", "Fi" },
|
|
336 |
{ "key_f55", "kf55", "Fj" },
|
|
337 |
{ "key_f56", "kf56", "Fk" },
|
|
338 |
{ "key_f57", "kf57", "Fl" },
|
|
339 |
{ "key_f58", "kf58", "Fm" },
|
|
340 |
{ "key_f59", "kf59", "Fn" },
|
|
341 |
{ "key_f6", "kf6", "k6" },
|
|
342 |
{ "key_f60", "kf60", "Fo" },
|
|
343 |
{ "key_f61", "kf61", "Fp" },
|
|
344 |
{ "key_f62", "kf62", "Fq" },
|
|
345 |
{ "key_f63", "kf63", "Fr" },
|
|
346 |
{ "key_f7", "kf7", "k7" },
|
|
347 |
{ "key_f8", "kf8", "k8" },
|
|
348 |
{ "key_f9", "kf9", "k9" },
|
|
349 |
{ "key_find", "kfnd", "@0" },
|
|
350 |
{ "key_help", "khlp", "%1" },
|
|
351 |
{ "key_home", "khome", "kh" },
|
|
352 |
{ "key_ic", "kich1", "kI" },
|
|
353 |
{ "key_il", "kil1", "kA" },
|
|
354 |
{ "key_left", "kcub1", "kl" },
|
|
355 |
{ "key_ll", "kll", "kH" },
|
|
356 |
{ "key_mark", "kmrk", "%2" },
|
|
357 |
{ "key_message", "kmsg", "%3" },
|
|
358 |
{ "key_move", "kmov", "%4" },
|
|
359 |
{ "key_next", "knxt", "%5" },
|
|
360 |
{ "key_npage", "knp", "kN" },
|
|
361 |
{ "key_open", "kopn", "%6" },
|
|
362 |
{ "key_options", "kopt", "%7" },
|
|
363 |
{ "key_ppage", "kpp", "kP" },
|
|
364 |
{ "key_previous", "kprv", "%8" },
|
|
365 |
{ "key_print", "kprt", "%9" },
|
|
366 |
{ "key_redo", "krdo", "%0" },
|
|
367 |
{ "key_reference", "kref", "&1" },
|
|
368 |
{ "key_refresh", "krfr", "&2" },
|
|
369 |
{ "key_replace", "krpl", "&3" },
|
|
370 |
{ "key_restart", "krst", "&4" },
|
|
371 |
{ "key_resume", "kres", "&5" },
|
|
372 |
{ "key_right", "kcuf1", "kr" },
|
|
373 |
{ "key_save", "ksav", "&6" },
|
|
374 |
{ "key_sbeg", "kBEG", "&9" },
|
|
375 |
{ "key_scancel", "kCAN", "&0" },
|
|
376 |
{ "key_scommand", "kCMD", "*1" },
|
|
377 |
{ "key_scopy", "kCPY", "*2" },
|
|
378 |
{ "key_screate", "kCRT", "*3" },
|
|
379 |
{ "key_sdc", "kDC", "*4" },
|
|
380 |
{ "key_sdl", "kDL", "*5" },
|
|
381 |
{ "key_select", "kslt", "*6" },
|
|
382 |
{ "key_send", "kEND", "*7" },
|
|
383 |
{ "key_seol", "kEOL", "*8" },
|
|
384 |
{ "key_sexit", "kEXT", "*9" },
|
|
385 |
{ "key_sf", "kind", "kF" },
|
|
386 |
{ "key_sfind", "kFND", "*0" },
|
|
387 |
{ "key_shelp", "kHLP", "#1" },
|
|
388 |
{ "key_shome", "kHOM", "#2" },
|
|
389 |
{ "key_sic", "kIC", "#3" },
|
|
390 |
{ "key_sleft", "kLFT", "#4" },
|
|
391 |
{ "key_smessage", "kMSG", "%a" },
|
|
392 |
{ "key_smove", "kMOV", "%b" },
|
|
393 |
{ "key_snext", "kNXT", "%c" },
|
|
394 |
{ "key_soptions", "kOPT", "%d" },
|
|
395 |
{ "key_sprevious", "kPRV", "%e" },
|
|
396 |
{ "key_sprint", "kPRT", "%f" },
|
|
397 |
{ "key_sr", "kri", "kR" },
|
|
398 |
{ "key_sredo", "kRDO", "%g" },
|
|
399 |
{ "key_sreplace", "kRPL", "%h" },
|
|
400 |
{ "key_sright", "kRIT", "%i" },
|
|
401 |
{ "key_srsume", "kRES", "%j" },
|
|
402 |
{ "key_ssave", "kSAV", "!1" },
|
|
403 |
{ "key_ssuspend", "kSPD", "!2" },
|
|
404 |
{ "key_stab", "khts", "kT" },
|
|
405 |
{ "key_sundo", "kUND", "!3" },
|
|
406 |
{ "key_suspend", "kspd", "&7" },
|
|
407 |
{ "key_undo", "kund", "&8" },
|
|
408 |
{ "key_up", "kcuu1", "ku" },
|
|
409 |
{ "keypad_local", "rmkx", "ke" },
|
|
410 |
{ "keypad_xmit", "smkx", "ks" },
|
|
411 |
{ "lab_f0", "lf0", "l0" },
|
|
412 |
{ "lab_f1", "lf1", "l1" },
|
|
413 |
{ "lab_f10", "lf10", "la" },
|
|
414 |
{ "lab_f2", "lf2", "l2" },
|
|
415 |
{ "lab_f3", "lf3", "l3" },
|
|
416 |
{ "lab_f4", "lf4", "l4" },
|
|
417 |
{ "lab_f5", "lf5", "l5" },
|
|
418 |
{ "lab_f6", "lf6", "l6" },
|
|
419 |
{ "lab_f7", "lf7", "l7" },
|
|
420 |
{ "lab_f8", "lf8", "l8" },
|
|
421 |
{ "lab_f9", "lf9", "l9" },
|
|
422 |
{ "label_format", "fln", "Lf" },
|
|
423 |
{ "label_off", "rmln", "LF" },
|
|
424 |
{ "label_on", "smln", "LO" },
|
|
425 |
{ "meta_off", "rmm", "mo" },
|
|
426 |
{ "meta_on", "smm", "mm" },
|
|
427 |
{ "micro_column_address", "mhpa", "ZY" },
|
|
428 |
{ "micro_down", "mcud1", "ZZ" },
|
|
429 |
{ "micro_left", "mcub1", "Za" },
|
|
430 |
{ "micro_right", "mcuf1", "Zb" },
|
|
431 |
{ "micro_row_address", "mvpa", "Zc" },
|
|
432 |
{ "micro_up", "mcuu1", "Zd" },
|
|
433 |
{ "newline", "nel", "nw" },
|
|
434 |
{ "order_of_pins", "porder", "Ze" },
|
|
435 |
{ "orig_colors", "oc", "oc" },
|
|
436 |
{ "orig_pair", "op", "op" },
|
|
437 |
{ "pad_char", "pad", "pc" },
|
|
438 |
{ "parm_dch", "dch", "DC" },
|
|
439 |
{ "parm_delete_line", "dl", "DL" },
|
|
440 |
{ "parm_down_cursor", "cud", "DO" },
|
|
441 |
{ "parm_down_micro", "mcud", "Zf" },
|
|
442 |
{ "parm_ich", "ich", "IC" },
|
|
443 |
{ "parm_index", "indn", "SF" },
|
|
444 |
{ "parm_insert_line", "il", "AL" },
|
|
445 |
{ "parm_left_cursor", "cub", "LE" },
|
|
446 |
{ "parm_left_micro", "mcub", "Zg" },
|
|
447 |
{ "parm_right_cursor", "cuf", "RI" },
|
|
448 |
{ "parm_right_micro", "mcuf", "Zh" },
|
|
449 |
{ "parm_rindex", "rin", "SR" },
|
|
450 |
{ "parm_up_cursor", "cuu", "UP" },
|
|
451 |
{ "parm_up_micro", "mcuu", "Zi" },
|
|
452 |
{ "pkey_key", "pfkey", "pk" },
|
|
453 |
{ "pkey_local", "pfloc", "pl" },
|
|
454 |
{ "pkey_xmit", "pfx", "px" },
|
|
455 |
{ "plab_norm", "pln", "pn" },
|
|
456 |
{ "print_screen", "mc0", "ps" },
|
|
457 |
{ "prtr_non", "mc5p", "pO" },
|
|
458 |
{ "prtr_off", "mc4", "pf" },
|
|
459 |
{ "prtr_on", "mc5", "po" },
|
|
460 |
{ "pulse", "pulse", "PU" },
|
|
461 |
{ "quick_dial", "qdial", "QD" },
|
|
462 |
{ "remove_clock", "rmclk", "RC" },
|
|
463 |
{ "repeat_char", "rep", "rp" },
|
|
464 |
{ "req_for_input", "rfi", "RF" },
|
|
465 |
{ "reset_1string", "rs1", "r1" },
|
|
466 |
{ "reset_2string", "rs2", "r2" },
|
|
467 |
{ "reset_3string", "rs3", "r3" },
|
|
468 |
{ "reset_file", "rf", "rf" },
|
|
469 |
{ "restore_cursor", "rc", "rc" },
|
|
470 |
{ "row_address", "vpa", "cv" },
|
|
471 |
{ "save_cursor", "sc", "sc" },
|
|
472 |
{ "scroll_forward", "ind", "sf" },
|
|
473 |
{ "scroll_reverse", "ri", "sr" },
|
|
474 |
{ "select_char_set", "scs", "Zj" },
|
|
475 |
{ "set_attributes", "sgr", "sa" },
|
|
476 |
{ "set_background", "setb", "Sb" },
|
|
477 |
{ "set_bottom_margin", "smgb", "Zk" },
|
|
478 |
{ "set_bottom_margin_parm", "smgbp", "Zl" },
|
|
479 |
{ "set_clock", "sclk", "SC" },
|
|
480 |
{ "set_color_pair", "scp", "sp" },
|
|
481 |
{ "set_foreground", "setf", "Sf" },
|
|
482 |
{ "set_left_margin", "smgl", "ML" },
|
|
483 |
{ "set_left_margin_parm", "smglp", "Zm" },
|
|
484 |
{ "set_right_margin", "smgr", "MR" },
|
|
485 |
{ "set_right_margin_parm", "smgrp", "Zn" },
|
|
486 |
{ "set_tab", "hts", "st" },
|
|
487 |
{ "set_top_margin", "smgt", "Zo" },
|
|
488 |
{ "set_top_margin_parm", "smgtp", "Zp" },
|
|
489 |
{ "set_window", "wind", "wi" },
|
|
490 |
{ "start_bit_image", "sbim", "Zq" },
|
|
491 |
{ "start_char_set_def", "scsd", "Zr" },
|
|
492 |
{ "stop_bit_image", "rbim", "Zs" },
|
|
493 |
{ "stop_char_set_def", "rcsd", "Zt" },
|
|
494 |
{ "subscript_characters", "subcs", "Zu" },
|
|
495 |
{ "superscript_characters", "supcs", "Zv" },
|
|
496 |
{ "tab", "ht", "ta" },
|
|
497 |
{ "these_cause_cr", "docr", "Zw" },
|
|
498 |
{ "to_status_line", "tsl", "ts" },
|
|
499 |
{ "tone", "tone", "TO" },
|
|
500 |
{ "underline_char", "uc", "uc" },
|
|
501 |
{ "up_half_line", "hu", "hu" },
|
|
502 |
{ "user0", "u0", "u0" },
|
|
503 |
{ "user1", "u1", "u1" },
|
|
504 |
{ "user2", "u2", "u2" },
|
|
505 |
{ "user3", "u3", "u3" },
|
|
506 |
{ "user4", "u4", "u4" },
|
|
507 |
{ "user5", "u5", "u5" },
|
|
508 |
{ "user6", "u6", "u6" },
|
|
509 |
{ "user7", "u7", "u7" },
|
|
510 |
{ "user8", "u8", "u8" },
|
|
511 |
{ "user9", "u9", "u9" },
|
|
512 |
{ "wait_tone", "wait", "WA" },
|
|
513 |
{ "xoff_character", "xoffc", "XF" },
|
|
514 |
{ "xon_character", "xonc", "XN" },
|
|
515 |
{ "zero_motion", "zerom", "Zx" },
|
|
516 |
{ "alt_scancode_esc", "scesa", "S8" },
|
|
517 |
{ "bit_image_carriage_return", "bicr", "Yv" },
|
|
518 |
{ "bit_image_newline", "binel", "Zz" },
|
|
519 |
{ "bit_image_repeat", "birep", "Xy" },
|
|
520 |
{ "char_set_names", "csnm", "Zy" },
|
|
521 |
{ "code_set_init", "csin", "ci" },
|
|
522 |
{ "color_names", "colornm", "Yw" },
|
|
523 |
{ "define_bit_image_region", "defbi", "Yx" },
|
|
524 |
{ "device_type", "devt", "dv" },
|
|
525 |
{ "display_pc_char", "dispc", "S1" },
|
|
526 |
{ "end_bit_image_region", "endbi", "Yy" },
|
|
527 |
{ "enter_pc_charset_mode", "smpch", "S2" },
|
|
528 |
{ "enter_scancode_mode", "smsc", "S4" },
|
|
529 |
{ "exit_pc_charset_mode", "rmpch", "S3" },
|
|
530 |
{ "exit_scancode_mode", "rmsc", "S5" },
|
|
531 |
{ "get_mouse", "getm", "Gm" },
|
|
532 |
{ "key_mouse", "kmous", "Km" },
|
|
533 |
{ "mouse_info", "minfo", "Mi" },
|
|
534 |
{ "pc_term_options", "pctrm", "S6" },
|
|
535 |
{ "pkey_plab", "pfxl", "xl" },
|
|
536 |
{ "req_mouse_pos", "reqmp", "RQ" },
|
|
537 |
{ "scancode_escape", "scesc", "S7" },
|
|
538 |
{ "set0_des_seq", "s0ds", "s0" },
|
|
539 |
{ "set1_des_seq", "s1ds", "s1" },
|
|
540 |
{ "set2_des_seq", "s2ds", "s2" },
|
|
541 |
{ "set3_des_seq", "s3ds", "s3" },
|
|
542 |
{ "set_a_background", "setab", "AB" },
|
|
543 |
{ "set_a_foreground", "setaf", "AF" },
|
|
544 |
{ "set_color_band", "setcolor", "Yz" },
|
|
545 |
{ "set_lr_margin", "smglr", "ML" },
|
|
546 |
{ "set_page_length", "slines", "YZ" },
|
|
547 |
{ "set_tb_margin", "smgtb", "MT" },
|
|
548 |
{ "enter_horizontal_hl_mode", "ehhlm", "Xh" },
|
|
549 |
{ "enter_left_hl_mode", "elhlm", "Xl" },
|
|
550 |
{ "enter_low_hl_mode", "elohlm", "Xo" },
|
|
551 |
{ "enter_right_hl_mode", "erhlm", "Xr" },
|
|
552 |
{ "enter_top_hl_mode", "ethlm", "Xt" },
|
|
553 |
{ "enter_vertical_hl_mode", "evhlm", "Xv" },
|
|
554 |
{ "set_a_attributes", "sgr1", "sA" },
|
|
555 |
{ "set_pglen_inch", "slength", "sL" }
|
|
556 |
};
|
|
557 |
|
|
558 |
Map<String, String[]> map = new HashMap<String, String[]>();
|
|
559 |
for (String[] names : list) {
|
|
560 |
for (String name : names) {
|
|
561 |
map.put(name, names);
|
|
562 |
}
|
|
563 |
}
|
|
564 |
NAMES = Collections.unmodifiableMap(map);
|
|
565 |
}
|
|
566 |
|
|
567 |
private static String ANSI_CAPS =
|
|
568 |
"#\tReconstructed via infocmp from file: /usr/share/terminfo/61/ansi\n" +
|
|
569 |
"ansi|ansi/pc-term compatible with color,\n" +
|
|
570 |
"\tam, mc5i, mir, msgr,\n" +
|
|
571 |
"\tcolors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,\n" +
|
|
572 |
"\tacsc=+\\020\\,\\021-\\030.^Y0\\333`\\004a\\261f\\370g\\361h\\260j\\331k\\277l\\332m\\300n\\305o~p\\304q\\304r\\304s_t\\303u\\264v\\301w\\302x\\263y\\363z\\362{\\343|\\330}\\234~\\376,\n" +
|
|
573 |
"\tbel=^G, blink=\\E[5m, bold=\\E[1m, cbt=\\E[Z, clear=\\E[H\\E[J,\n" +
|
|
574 |
"\tcr=^M, cub=\\E[%p1%dD, cub1=\\E[D, cud=\\E[%p1%dB, cud1=\\E[B,\n" +
|
|
575 |
"\tcuf=\\E[%p1%dC, cuf1=\\E[C, cup=\\E[%i%p1%d;%p2%dH,\n" +
|
|
576 |
"\tcuu=\\E[%p1%dA, cuu1=\\E[A, dch=\\E[%p1%dP, dch1=\\E[P,\n" +
|
|
577 |
"\tdl=\\E[%p1%dM, dl1=\\E[M, ech=\\E[%p1%dX, ed=\\E[J, el=\\E[K,\n" +
|
|
578 |
"\tel1=\\E[1K, home=\\E[H, hpa=\\E[%i%p1%dG, ht=\\E[I, hts=\\EH,\n" +
|
|
579 |
"\tich=\\E[%p1%d@, il=\\E[%p1%dL, il1=\\E[L, ind=^J,\n" +
|
|
580 |
"\tindn=\\E[%p1%dS, invis=\\E[8m, kbs=^H, kcbt=\\E[Z, kcub1=\\E[D,\n" +
|
|
581 |
"\tkcud1=\\E[B, kcuf1=\\E[C, kcuu1=\\E[A, khome=\\E[H, kich1=\\E[L,\n" +
|
|
582 |
"\tmc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S, op=\\E[39;49m,\n" +
|
|
583 |
"\trep=%p1%c\\E[%p2%{1}%-%db, rev=\\E[7m, rin=\\E[%p1%dT,\n" +
|
|
584 |
"\trmacs=\\E[10m, rmpch=\\E[10m, rmso=\\E[m, rmul=\\E[m,\n" +
|
|
585 |
"\ts0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B, s3ds=\\E+B,\n" +
|
|
586 |
"\tsetab=\\E[4%p1%dm, setaf=\\E[3%p1%dm,\n" +
|
|
587 |
"\tsgr=\\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,\n" +
|
|
588 |
"\tsgr0=\\E[0;10m, smacs=\\E[11m, smpch=\\E[11m, smso=\\E[7m,\n" +
|
|
589 |
"\tsmul=\\E[4m, tbc=\\E[2g, u6=\\E[%i%d;%dR, u7=\\E[6n,\n" +
|
|
590 |
"\tu8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%i%p1%dd,";
|
|
591 |
}
|