caps.c 12.7 KB
Newer Older
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
1 2 3
/*
 * Copyright (C) 2001,2002 Red Hat, Inc.
 *
4 5 6 7
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
8
 *
9 10
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
13
 *
14 15 16
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
17 18
 */

19
#include <config.h>
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
20 21 22 23
#include <stdlib.h>
#include <glib.h>
#include "caps.h"

24 25 26 27 28 29
#define ESC _VTE_CAP_ESC
#define CSI _VTE_CAP_CSI
#define ST  _VTE_CAP_ST
#define OSC _VTE_CAP_OSC
#define PM  _VTE_CAP_PM
#define APC _VTE_CAP_APC
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
30

31 32 33 34 35 36 37 38 39 40
#define ENQ "\005"
#define BEL "\007"
#define BS  "\010"
#define TAB "\011"
#define LF  "\012"
#define VT  "\013"
#define FF  "\014"
#define CR  "\015"
#define SO  "\016"
#define SI  "\017"
41
#define DEL "\177"
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
42

43 44 45
#define ENTRY(seq, name) seq "\0" name "\0"
#define COMMENT(c)

Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
46 47
/* From some really old XTerm docs we had at the office, and an updated
 * version at Moy, Gildea, and Dickey. */
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
const char _vte_xterm_capability_strings[] =
        ENTRY(ENQ, "return-terminal-status")
        ENTRY(BEL, "bell")
        ENTRY(BS,  "backspace")
        ENTRY(TAB, "tab")
        ENTRY(LF,  "line-feed")
        ENTRY(VT,  "vertical-tab")
        ENTRY(FF,  "form-feed")
        ENTRY(CR,  "carriage-return")
        ENTRY(DEL, "backspace")

        ENTRY(ESC " F", "7-bit-controls")
        ENTRY(ESC " G", "8-bit-controls")
        ENTRY(ESC " L", "ansi-conformance-level-1")
        ENTRY(ESC " M", "ansi-conformance-level-2")
        ENTRY(ESC " N", "ansi-conformance-level-3")
        ENTRY(ESC "#3", "double-height-top-half")
        ENTRY(ESC "#4", "double-height-bottom-half")
        ENTRY(ESC "#5", "single-width")
        ENTRY(ESC "#6", "double-width")
        ENTRY(ESC "#8", "screen-alignment-test")
69

70 71 72 73 74
        COMMENT(/* These are actually designate-other-coding-system from ECMA 35,)
                   COMMENT( * but we don't support the full repertoire.  Actually, we don't)
                   COMMENT( * know what the full repertoire looks like. */)
        ENTRY(ESC "%%@", "default-character-set")
        ENTRY(ESC "%%G", "utf-8-character-set")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
75

76 77
        ENTRY(ESC "(0", "alternate-character-set-start")
        ENTRY(ESC "(B", "alternate-character-set-end")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
78

79 80 81 82 83 84 85 86 87 88 89
        ENTRY(ESC "7", "save-cursor")
        ENTRY(ESC "8", "restore-cursor")
        ENTRY(ESC "=", "application-keypad")
        ENTRY(ESC ">", "normal-keypad")
        ENTRY(ESC "D", "index")
        ENTRY(ESC "E", "next-line")
        COMMENT(/* ENTRY(ESC "F", "cursor-lower-left") */)
        ENTRY(ESC "H", "tab-set")
        ENTRY(ESC "M", "reverse-index")
        COMMENT(/* ENTRY(ESC "N", "single-shift-g2") */)
        COMMENT(/* ENTRY(ESC "O", "single-shift-g3") */)
Behdad Esfahbod's avatar
Behdad Esfahbod committed
90
        ENTRY(ESC "P%s" ST, "device-control-string")
91 92
        ENTRY(ESC "V", "start-of-guarded-area")
        ENTRY(ESC "W", "end-of-guarded-area")
93
        ENTRY(ESC "X%s" ST, "start-of-string / end-of-string")
94 95 96 97 98 99 100 101 102
        ENTRY(ESC "Z", "return-terminal-id")
        ENTRY(ESC "c", "full-reset")
        ENTRY(ESC "l", "memory-lock")
        ENTRY(ESC "m", "memory-unlock")
        COMMENT(/* ENTRY(ESC "n", "invoke-g2-character-set") */)
        COMMENT(/* ENTRY(ESC "o", "invoke-g3-character-set") */)
        COMMENT(/* ENTRY(ESC "|", "invoke-g3-character-set-as-gr") */)
        COMMENT(/* ENTRY(ESC "}", "invoke-g2-character-set-as-gr") */)
        COMMENT(/* ENTRY(ESC "~", "invoke-g1-character-set-as-gr") */)
103

104
        COMMENT(/* APC stuff omitted. */)
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
105

106
        COMMENT(/* DCS stuff omitted. */)
107

108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
        ENTRY(CSI "@", "insert-blank-characters")
        ENTRY(CSI "%d@", "insert-blank-characters")
        ENTRY(CSI "A", "cursor-up")
        ENTRY(CSI "%dA", "cursor-up")
        ENTRY(CSI "B", "cursor-down")
        ENTRY(CSI "%dB", "cursor-down")
        ENTRY(CSI "C", "cursor-forward")
        ENTRY(CSI "%dC", "cursor-forward")
        ENTRY(CSI "D", "cursor-backward")
        ENTRY(CSI "%dD", "cursor-backward")
        ENTRY(CSI "E", "cursor-next-line")
        ENTRY(CSI "%dE", "cursor-next-line")
        ENTRY(CSI "F", "cursor-preceding-line")
        ENTRY(CSI "%dF", "cursor-preceding-line")
        ENTRY(CSI "G", "cursor-character-absolute")
        ENTRY(CSI "%dG", "cursor-character-absolute")
        ENTRY(CSI "H", "cursor-position")
        ENTRY(CSI ";H", "cursor-position")
        ENTRY(CSI "%dH", "cursor-position")
        ENTRY(CSI "%d;H", "cursor-position")
        ENTRY(CSI ";%dH", "cursor-position-top-row")
        ENTRY(CSI "%d;%dH", "cursor-position")
        ENTRY(CSI "I", "cursor-forward-tabulation")
        ENTRY(CSI "%dI", "cursor-forward-tabulation")
        ENTRY(CSI "J", "erase-in-display")
        ENTRY(CSI "%dJ", "erase-in-display")
        ENTRY(CSI "?J", "selective-erase-in-display")
        ENTRY(CSI "?%dJ", "selective-erase-in-display")
        ENTRY(CSI "K", "erase-in-line")
        ENTRY(CSI "%dK", "erase-in-line")
        ENTRY(CSI "?K", "selective-erase-in-line")
        ENTRY(CSI "?%dK", "selective-erase-in-line")
        ENTRY(CSI "L", "insert-lines")
        ENTRY(CSI "%dL", "insert-lines")
        ENTRY(CSI "M", "delete-lines")
        ENTRY(CSI "%dM", "delete-lines")
        ENTRY(CSI "P", "delete-characters")
        ENTRY(CSI "%dP", "delete-characters")
        ENTRY(CSI "S", "scroll-up")
        ENTRY(CSI "%dS", "scroll-up")
        ENTRY(CSI "T", "scroll-down")
        ENTRY(CSI "%dT", "scroll-down")
        ENTRY(CSI "%d;%d;%d;%d;%dT", "initiate-hilite-mouse-tracking")
        ENTRY(CSI "X", "erase-characters")
        ENTRY(CSI "%dX", "erase-characters")
        ENTRY(CSI "Z", "cursor-back-tab")
        ENTRY(CSI "%dZ", "cursor-back-tab")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
155

156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
        ENTRY(CSI "`", "character-position-absolute")
        ENTRY(CSI "%d`", "character-position-absolute")
        ENTRY(CSI "b", "repeat")
        ENTRY(CSI "%db", "repeat")
        ENTRY(CSI "c", "send-primary-device-attributes")
        ENTRY(CSI "%dc", "send-primary-device-attributes")
        ENTRY(CSI ">c", "send-secondary-device-attributes")
        ENTRY(CSI ">%dc", "send-secondary-device-attributes")
        ENTRY(CSI "=c", "send-tertiary-device-attributes")
        ENTRY(CSI "=%dc", "send-tertiary-device-attributes")
        ENTRY(CSI "?%mc", "linux-console-cursor-attributes")
        ENTRY(CSI "d", "line-position-absolute")
        ENTRY(CSI "%dd", "line-position-absolute")
        ENTRY(CSI "f", "cursor-position")
        ENTRY(CSI ";f", "cursor-position")
        ENTRY(CSI "%df", "cursor-position")
        ENTRY(CSI "%d;f", "cursor-position")
        ENTRY(CSI ";%df", "cursor-position-top-row")
        ENTRY(CSI "%d;%df", "cursor-position")
        ENTRY(CSI "g", "tab-clear")
        ENTRY(CSI "%dg", "tab-clear")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
177

178 179
        ENTRY(CSI "%mh", "set-mode")
        ENTRY(CSI "?%mh", "decset")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
180

181 182
        ENTRY(CSI "%mi", "media-copy")
        ENTRY(CSI "?%mi", "dec-media-copy")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
183

184 185
        ENTRY(CSI "%ml", "reset-mode")
        ENTRY(CSI "?%ml", "decreset")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
186

187
        ENTRY(CSI "%mm", "character-attributes")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
188

189 190 191 192
        ENTRY(CSI "%dn", "device-status-report")
        ENTRY(CSI "?%dn", "dec-device-status-report")
        ENTRY(CSI "!p", "soft-reset")
        ENTRY(CSI "%d;%d\"p", "set-conformance-level")
193 194
        ENTRY(CSI " q", "set-cursor-style")
        ENTRY(CSI "%d q", "set-cursor-style")
195
        ENTRY(CSI "%d\"q", "select-character-protection")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
196

197 198 199 200 201 202
        ENTRY(CSI "r", "set-scrolling-region")
        ENTRY(CSI ";r", "set-scrolling-region")
        ENTRY(CSI ";%dr", "set-scrolling-region-from-start")
        ENTRY(CSI "%dr", "set-scrolling-region-to-end")
        ENTRY(CSI "%d;r", "set-scrolling-region-to-end")
        ENTRY(CSI "%d;%dr", "set-scrolling-region")
203

204 205 206 207
        ENTRY(CSI "?%mr", "restore-mode")
        ENTRY(CSI "s", "save-cursor")
        ENTRY(CSI "?%ms", "save-mode")
        ENTRY(CSI "u", "restore-cursor")
208

209
        ENTRY(CSI "%mt", "window-manipulation")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
210

211 212 213
        ENTRY(CSI "%d;%d;%d;%dw", "enable-filter-rectangle")
        ENTRY(CSI "%dx", "request-terminal-parameters")
        ENTRY(CSI "%d;%d'z", "enable-locator-reporting")
214
        ENTRY(CSI "%m'{", "select-locator-events")
215
        ENTRY(CSI "%d'|", "request-locator-position")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
216

217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
        COMMENT(/* Set text parameters, BEL-terminated versions. */)
        ENTRY(OSC ";%s" BEL, "set-icon-and-window-title") COMMENT(/* undocumented default */)
        ENTRY(OSC "0;%s" BEL, "set-icon-and-window-title")
        ENTRY(OSC "1;%s" BEL, "set-icon-title")
        ENTRY(OSC "2;%s" BEL, "set-window-title")
        ENTRY(OSC "3;%s" BEL, "set-xproperty")
        ENTRY(OSC "4;%s" BEL, "change-color-bel")
        ENTRY(OSC "6;%s" BEL, "set-current-file-uri")
        ENTRY(OSC "7;%s" BEL, "set-current-directory-uri")
        ENTRY(OSC "10;%s" BEL, "change-foreground-color-bel")
        ENTRY(OSC "11;%s" BEL, "change-background-color-bel")
        ENTRY(OSC "12;%s" BEL, "change-cursor-color-bel")
        ENTRY(OSC "13;%s" BEL, "change-mouse-cursor-foreground-color-bel")
        ENTRY(OSC "14;%s" BEL, "change-mouse-cursor-background-color-bel")
        ENTRY(OSC "15;%s" BEL, "change-tek-foreground-color-bel")
        ENTRY(OSC "16;%s" BEL, "change-tek-background-color-bel")
        ENTRY(OSC "17;%s" BEL, "change-highlight-background-color-bel")
        ENTRY(OSC "18;%s" BEL, "change-tek-cursor-color-bel")
        ENTRY(OSC "19;%s" BEL, "change-highlight-foreground-color-bel")
        ENTRY(OSC "46;%s" BEL, "change-logfile")
        ENTRY(OSC "50;#%d" BEL, "change-font-number")
        ENTRY(OSC "50;%s" BEL, "change-font-name")
        ENTRY(OSC "104" BEL, "reset-color")
        ENTRY(OSC "104;%m" BEL, "reset-color")
        ENTRY(OSC "110" BEL, "reset-foreground-color")
        ENTRY(OSC "111" BEL, "reset-background-color")
        ENTRY(OSC "112" BEL, "reset-cursor-color")
        ENTRY(OSC "113" BEL, "reset-mouse-cursor-foreground-color")
        ENTRY(OSC "114" BEL, "reset-mouse-cursor-background-color")
        ENTRY(OSC "115" BEL, "reset-tek-foreground-color")
        ENTRY(OSC "116" BEL, "reset-tek-background-color")
        ENTRY(OSC "117" BEL, "reset-highlight-background-color")
        ENTRY(OSC "118" BEL, "reset-tek-cursor-color")
        ENTRY(OSC "119" BEL, "reset-highlight-foreground-color")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
251

252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
        COMMENT(/* Set text parameters, ST-terminated versions. */)
        ENTRY(OSC ";%s" ST, "set-icon-and-window-title") COMMENT(/* undocumented default */)
        ENTRY(OSC "0;%s" ST, "set-icon-and-window-title")
        ENTRY(OSC "1;%s" ST, "set-icon-title")
        ENTRY(OSC "2;%s" ST, "set-window-title")
        ENTRY(OSC "3;%s" ST, "set-xproperty")
        ENTRY(OSC "4;%s" ST, "change-color-st")
        ENTRY(OSC "6;%s" ST, "set-current-file-uri")
        ENTRY(OSC "7;%s" ST, "set-current-directory-uri")
        ENTRY(OSC "10;%s" ST, "change-foreground-color-st")
        ENTRY(OSC "11;%s" ST, "change-background-color-st")
        ENTRY(OSC "12;%s" ST, "change-cursor-color-st")
        ENTRY(OSC "13;%s" ST, "change-mouse-cursor-foreground-color-st")
        ENTRY(OSC "14;%s" ST, "change-mouse-cursor-background-color-st")
        ENTRY(OSC "15;%s" ST, "change-tek-foreground-color-st")
        ENTRY(OSC "16;%s" ST, "change-tek-background-color-st")
        ENTRY(OSC "17;%s" ST, "change-highlight-background-color-st")
        ENTRY(OSC "18;%s" ST, "change-tek-cursor-color-st")
        ENTRY(OSC "19;%s" ST, "change-highlight-foreground-color-st")
        ENTRY(OSC "46;%s" ST, "change-logfile")
        ENTRY(OSC "50;#%d" ST, "change-font-number")
        ENTRY(OSC "50;%s" ST, "change-font-name")
        ENTRY(OSC "104" ST, "reset-color")
        ENTRY(OSC "104;%m" ST, "reset-color")
        ENTRY(OSC "110" ST, "reset-foreground-color")
        ENTRY(OSC "111" ST, "reset-background-color")
        ENTRY(OSC "112" ST, "reset-cursor-color")
        ENTRY(OSC "113" ST, "reset-mouse-cursor-foreground-color")
        ENTRY(OSC "114" ST, "reset-mouse-cursor-background-color")
        ENTRY(OSC "115" ST, "reset-tek-foreground-color")
        ENTRY(OSC "116" ST, "reset-tek-background-color")
        ENTRY(OSC "117" ST, "reset-highlight-background-color")
        ENTRY(OSC "118" ST, "reset-tek-cursor-color")
        ENTRY(OSC "119" ST, "reset-highlight-foreground-color")
Nalin Dahyabhai's avatar
Nalin Dahyabhai committed
286

287 288 289 290 291
        COMMENT(/* These may be bogus, I can't find docs for them anywhere (#104154). */)
        ENTRY(OSC "21;%s" BEL, "set-text-property-21")
        ENTRY(OSC "2L;%s" BEL, "set-text-property-2L")
        ENTRY(OSC "21;%s" ST, "set-text-property-21")
        ENTRY(OSC "2L;%s" ST, "set-text-property-2L")
292

293
        "\0";
294

295 296
#undef ENTRY
#undef COMMENT