1 /* 2 * Copyright (C) 2001,2002 Red Hat, Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #include <config.h> 20 #include <stdlib.h> 21 #include <glib.h> 22 #include "caps.h" 23 24 #define ESC _VTE_CAP_ESC 25 #define CSI _VTE_CAP_CSI 26 #define ST _VTE_CAP_ST 27 #define OSC _VTE_CAP_OSC 28 #define PM _VTE_CAP_PM 29 #define APC _VTE_CAP_APC 30 31 #define ENQ "\005" 32 #define BEL "\007" 33 #define BS "\010" 34 #define TAB "\011" 35 #define LF "\012" 36 #define VT "\013" 37 #define FF "\014" 38 #define CR "\015" 39 #define SO "\016" 40 #define SI "\017" 41 #define DEL "\177" 42 43 #define ENTRY(seq, name) seq "\0" name "\0" 44 #define COMMENT(c) 45 46 /* From some really old XTerm docs we had at the office, and an updated 47 * version at Moy, Gildea, and Dickey. */ 48 const char _vte_xterm_capability_strings[] = 49 ENTRY(ENQ, "return-terminal-status") 50 ENTRY(BEL, "bell") 51 ENTRY(BS, "backspace") 52 ENTRY(TAB, "tab") 53 ENTRY(LF, "line-feed") 54 ENTRY(VT, "vertical-tab") 55 ENTRY(FF, "form-feed") 56 ENTRY(CR, "carriage-return") 57 ENTRY(SO, "shift-out") 58 ENTRY(SI, "shift-in") 59 ENTRY(DEL, "nop") 60 61 ENTRY(ESC " F", "7-bit-controls") 62 ENTRY(ESC " G", "8-bit-controls") 63 ENTRY(ESC " L", "ansi-conformance-level-1") 64 ENTRY(ESC " M", "ansi-conformance-level-2") 65 ENTRY(ESC " N", "ansi-conformance-level-3") 66 ENTRY(ESC "#3", "double-height-top-half") 67 ENTRY(ESC "#4", "double-height-bottom-half") 68 ENTRY(ESC "#5", "single-width") 69 ENTRY(ESC "#6", "double-width") 70 ENTRY(ESC "#8", "screen-alignment-test") 71 72 COMMENT(/* These are actually designate-other-coding-system from ECMA 35,) 73 COMMENT( * but we don't support the full repertoire. Actually, we don't) 74 COMMENT( * know what the full repertoire looks like. */) 75 ENTRY(ESC "%%@", "default-character-set") 76 ENTRY(ESC "%%G", "utf-8-character-set") 77 78 ENTRY(ESC "(0", "designate-g0-line-drawing") 79 ENTRY(ESC "(A", "designate-g0-british") 80 ENTRY(ESC "(B", "designate-g0-plain") 81 ENTRY(ESC ")0", "designate-g1-line-drawing") 82 ENTRY(ESC ")A", "designate-g1-british") 83 ENTRY(ESC ")B", "designate-g1-plain") 84 85 ENTRY(ESC "7", "save-cursor") 86 ENTRY(ESC "8", "restore-cursor") 87 ENTRY(ESC "=", "application-keypad") 88 ENTRY(ESC ">", "normal-keypad") 89 ENTRY(ESC "D", "index") 90 ENTRY(ESC "E", "next-line") 91 COMMENT(/* ENTRY(ESC "F", "cursor-lower-left") */) 92 ENTRY(ESC "H", "tab-set") 93 ENTRY(ESC "M", "reverse-index") 94 COMMENT(/* ENTRY(ESC "N", "single-shift-g2") */) 95 COMMENT(/* ENTRY(ESC "O", "single-shift-g3") */) 96 ENTRY(ESC "P%s" ST, "device-control-string") 97 ENTRY(ESC "V", "start-of-guarded-area") 98 ENTRY(ESC "W", "end-of-guarded-area") 99 ENTRY(ESC "X%s" ST, "start-of-string / end-of-string") 100 ENTRY(ESC "Z", "return-terminal-id") 101 ENTRY(ESC "c", "full-reset") 102 ENTRY(ESC "l", "memory-lock") 103 ENTRY(ESC "m", "memory-unlock") 104 COMMENT(/* ENTRY(ESC "n", "invoke-g2-character-set") */) 105 COMMENT(/* ENTRY(ESC "o", "invoke-g3-character-set") */) 106 COMMENT(/* ENTRY(ESC "|", "invoke-g3-character-set-as-gr") */) 107 COMMENT(/* ENTRY(ESC "}", "invoke-g2-character-set-as-gr") */) 108 COMMENT(/* ENTRY(ESC "~", "invoke-g1-character-set-as-gr") */) 109 110 COMMENT(/* APC stuff omitted. */) 111 112 COMMENT(/* DCS stuff omitted. */) 113 114 ENTRY(CSI "@", "insert-blank-characters") 115 ENTRY(CSI "%d@", "insert-blank-characters") 116 ENTRY(CSI "A", "cursor-up") 117 ENTRY(CSI "%dA", "cursor-up") 118 ENTRY(CSI "B", "cursor-down") 119 ENTRY(CSI "%dB", "cursor-down") 120 ENTRY(CSI "C", "cursor-forward") 121 ENTRY(CSI "%dC", "cursor-forward") 122 ENTRY(CSI "D", "cursor-backward") 123 ENTRY(CSI "%dD", "cursor-backward") 124 ENTRY(CSI "E", "cursor-next-line") 125 ENTRY(CSI "%dE", "cursor-next-line") 126 ENTRY(CSI "F", "cursor-preceding-line") 127 ENTRY(CSI "%dF", "cursor-preceding-line") 128 ENTRY(CSI "G", "cursor-character-absolute") 129 ENTRY(CSI "%dG", "cursor-character-absolute") 130 ENTRY(CSI "H", "cursor-position") 131 ENTRY(CSI ";H", "cursor-position") 132 ENTRY(CSI "%dH", "cursor-position") 133 ENTRY(CSI "%d;H", "cursor-position") 134 ENTRY(CSI ";%dH", "cursor-position-top-row") 135 ENTRY(CSI "%d;%dH", "cursor-position") 136 ENTRY(CSI "I", "cursor-forward-tabulation") 137 ENTRY(CSI "%dI", "cursor-forward-tabulation") 138 ENTRY(CSI "J", "erase-in-display") 139 ENTRY(CSI "%mJ", "erase-in-display") 140 ENTRY(CSI "?J", "selective-erase-in-display") 141 ENTRY(CSI "?%mJ", "selective-erase-in-display") 142 ENTRY(CSI "K", "erase-in-line") 143 ENTRY(CSI "%mK", "erase-in-line") 144 ENTRY(CSI "?K", "selective-erase-in-line") 145 ENTRY(CSI "?%mK", "selective-erase-in-line") 146 ENTRY(CSI "L", "insert-lines") 147 ENTRY(CSI "%dL", "insert-lines") 148 ENTRY(CSI "M", "delete-lines") 149 ENTRY(CSI "%dM", "delete-lines") 150 ENTRY(CSI "P", "delete-characters") 151 ENTRY(CSI "%dP", "delete-characters") 152 ENTRY(CSI "S", "scroll-up") 153 ENTRY(CSI "%dS", "scroll-up") 154 ENTRY(CSI "T", "scroll-down") 155 ENTRY(CSI "%dT", "scroll-down") 156 ENTRY(CSI "%d;%d;%d;%d;%dT", "initiate-hilite-mouse-tracking") 157 ENTRY(CSI "X", "erase-characters") 158 ENTRY(CSI "%dX", "erase-characters") 159 ENTRY(CSI "Z", "cursor-back-tab") 160 ENTRY(CSI "%dZ", "cursor-back-tab") 161 162 ENTRY(CSI "`", "character-position-absolute") 163 ENTRY(CSI "%d`", "character-position-absolute") 164 ENTRY(CSI "b", "repeat") 165 ENTRY(CSI "%db", "repeat") 166 ENTRY(CSI "c", "send-primary-device-attributes") 167 ENTRY(CSI "%dc", "send-primary-device-attributes") 168 ENTRY(CSI ">c", "send-secondary-device-attributes") 169 ENTRY(CSI ">%dc", "send-secondary-device-attributes") 170 ENTRY(CSI "=c", "send-tertiary-device-attributes") 171 ENTRY(CSI "=%dc", "send-tertiary-device-attributes") 172 ENTRY(CSI "?%mc", "linux-console-cursor-attributes") 173 ENTRY(CSI "d", "line-position-absolute") 174 ENTRY(CSI "%dd", "line-position-absolute") 175 ENTRY(CSI "f", "cursor-position") 176 ENTRY(CSI ";f", "cursor-position") 177 ENTRY(CSI "%df", "cursor-position") 178 ENTRY(CSI "%d;f", "cursor-position") 179 ENTRY(CSI ";%df", "cursor-position-top-row") 180 ENTRY(CSI "%d;%df", "cursor-position") 181 ENTRY(CSI "g", "tab-clear") 182 ENTRY(CSI "%dg", "tab-clear") 183 184 ENTRY(CSI "%mh", "set-mode") 185 ENTRY(CSI "?%mh", "decset") 186 187 ENTRY(CSI "%mi", "media-copy") 188 ENTRY(CSI "?%mi", "dec-media-copy") 189 190 ENTRY(CSI "%ml", "reset-mode") 191 ENTRY(CSI "?%ml", "decreset") 192 193 ENTRY(CSI "%mm", "character-attributes") 194 195 ENTRY(CSI "%dn", "device-status-report") 196 ENTRY(CSI "?%dn", "dec-device-status-report") 197 ENTRY(CSI "!p", "soft-reset") 198 ENTRY(CSI "%d;%d\"p", "set-conformance-level") 199 ENTRY(CSI " q", "set-cursor-style") 200 ENTRY(CSI "%d q", "set-cursor-style") 201 ENTRY(CSI "%d\"q", "select-character-protection") 202 203 ENTRY(CSI "r", "set-scrolling-region") 204 ENTRY(CSI ";r", "set-scrolling-region") 205 ENTRY(CSI ";%dr", "set-scrolling-region-from-start") 206 ENTRY(CSI "%dr", "set-scrolling-region-to-end") 207 ENTRY(CSI "%d;r", "set-scrolling-region-to-end") 208 ENTRY(CSI "%d;%dr", "set-scrolling-region") 209 210 ENTRY(CSI "?%mr", "restore-mode") 211 ENTRY(CSI "s", "save-cursor") 212 ENTRY(CSI "?%ms", "save-mode") 213 ENTRY(CSI "u", "restore-cursor") 214 215 ENTRY(CSI "%mt", "window-manipulation") 216 217 ENTRY(CSI "%d;%d;%d;%dw", "enable-filter-rectangle") 218 ENTRY(CSI "%dx", "request-terminal-parameters") 219 ENTRY(CSI "%d;%d'z", "enable-locator-reporting") 220 ENTRY(CSI "%m'{", "select-locator-events") 221 ENTRY(CSI "%d'|", "request-locator-position") 222 223 COMMENT(/* Set text parameters, BEL-terminated versions. */) 224 ENTRY(OSC ";%s" BEL, "set-icon-and-window-title") COMMENT(/* undocumented default */) 225 ENTRY(OSC "0;%s" BEL, "set-icon-and-window-title") 226 ENTRY(OSC "1;%s" BEL, "set-icon-title") 227 ENTRY(OSC "2;%s" BEL, "set-window-title") 228 ENTRY(OSC "3;%s" BEL, "set-xproperty") 229 ENTRY(OSC "4;%s" BEL, "change-color-bel") 230 ENTRY(OSC "6;%s" BEL, "set-current-file-uri") 231 ENTRY(OSC "7;%s" BEL, "set-current-directory-uri") 232 ENTRY(OSC "10;%s" BEL, "change-foreground-color-bel") 233 ENTRY(OSC "11;%s" BEL, "change-background-color-bel") 234 ENTRY(OSC "12;%s" BEL, "change-cursor-color-bel") 235 ENTRY(OSC "13;%s" BEL, "change-mouse-cursor-foreground-color-bel") 236 ENTRY(OSC "14;%s" BEL, "change-mouse-cursor-background-color-bel") 237 ENTRY(OSC "15;%s" BEL, "change-tek-foreground-color-bel") 238 ENTRY(OSC "16;%s" BEL, "change-tek-background-color-bel") 239 ENTRY(OSC "17;%s" BEL, "change-highlight-background-color-bel") 240 ENTRY(OSC "18;%s" BEL, "change-tek-cursor-color-bel") 241 ENTRY(OSC "19;%s" BEL, "change-highlight-foreground-color-bel") 242 ENTRY(OSC "46;%s" BEL, "change-logfile") 243 ENTRY(OSC "50;#%d" BEL, "change-font-number") 244 ENTRY(OSC "50;%s" BEL, "change-font-name") 245 ENTRY(OSC "104" BEL, "reset-color") 246 ENTRY(OSC "104;%m" BEL, "reset-color") 247 ENTRY(OSC "110" BEL, "reset-foreground-color") 248 ENTRY(OSC "111" BEL, "reset-background-color") 249 ENTRY(OSC "112" BEL, "reset-cursor-color") 250 ENTRY(OSC "113" BEL, "reset-mouse-cursor-foreground-color") 251 ENTRY(OSC "114" BEL, "reset-mouse-cursor-background-color") 252 ENTRY(OSC "115" BEL, "reset-tek-foreground-color") 253 ENTRY(OSC "116" BEL, "reset-tek-background-color") 254 ENTRY(OSC "117" BEL, "reset-highlight-background-color") 255 ENTRY(OSC "118" BEL, "reset-tek-cursor-color") 256 ENTRY(OSC "119" BEL, "reset-highlight-foreground-color") 257 258 COMMENT(/* Set text parameters, ST-terminated versions. */) 259 ENTRY(OSC ";%s" ST, "set-icon-and-window-title") COMMENT(/* undocumented default */) 260 ENTRY(OSC "0;%s" ST, "set-icon-and-window-title") 261 ENTRY(OSC "1;%s" ST, "set-icon-title") 262 ENTRY(OSC "2;%s" ST, "set-window-title") 263 ENTRY(OSC "3;%s" ST, "set-xproperty") 264 ENTRY(OSC "4;%s" ST, "change-color-st") 265 ENTRY(OSC "6;%s" ST, "set-current-file-uri") 266 ENTRY(OSC "7;%s" ST, "set-current-directory-uri") 267 ENTRY(OSC "10;%s" ST, "change-foreground-color-st") 268 ENTRY(OSC "11;%s" ST, "change-background-color-st") 269 ENTRY(OSC "12;%s" ST, "change-cursor-color-st") 270 ENTRY(OSC "13;%s" ST, "change-mouse-cursor-foreground-color-st") 271 ENTRY(OSC "14;%s" ST, "change-mouse-cursor-background-color-st") 272 ENTRY(OSC "15;%s" ST, "change-tek-foreground-color-st") 273 ENTRY(OSC "16;%s" ST, "change-tek-background-color-st") 274 ENTRY(OSC "17;%s" ST, "change-highlight-background-color-st") 275 ENTRY(OSC "18;%s" ST, "change-tek-cursor-color-st") 276 ENTRY(OSC "19;%s" ST, "change-highlight-foreground-color-st") 277 ENTRY(OSC "46;%s" ST, "change-logfile") 278 ENTRY(OSC "50;#%d" ST, "change-font-number") 279 ENTRY(OSC "50;%s" ST, "change-font-name") 280 ENTRY(OSC "104" ST, "reset-color") 281 ENTRY(OSC "104;%m" ST, "reset-color") 282 ENTRY(OSC "110" ST, "reset-foreground-color") 283 ENTRY(OSC "111" ST, "reset-background-color") 284 ENTRY(OSC "112" ST, "reset-cursor-color") 285 ENTRY(OSC "113" ST, "reset-mouse-cursor-foreground-color") 286 ENTRY(OSC "114" ST, "reset-mouse-cursor-background-color") 287 ENTRY(OSC "115" ST, "reset-tek-foreground-color") 288 ENTRY(OSC "116" ST, "reset-tek-background-color") 289 ENTRY(OSC "117" ST, "reset-highlight-background-color") 290 ENTRY(OSC "118" ST, "reset-tek-cursor-color") 291 ENTRY(OSC "119" ST, "reset-highlight-foreground-color") 292 293 COMMENT(/* These may be bogus, I can't find docs for them anywhere (#104154). */) 294 ENTRY(OSC "21;%s" BEL, "set-text-property-21") 295 ENTRY(OSC "2L;%s" BEL, "set-text-property-2L") 296 ENTRY(OSC "21;%s" ST, "set-text-property-21") 297 ENTRY(OSC "2L;%s" ST, "set-text-property-2L") 298 299 "\0"; 300 301 #undef ENTRY 302 #undef COMMENT 303