1 /* 2 * Copyright (C) 2001-2004 Red Hat, Inc. 3 * 4 * This library is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published 6 * by the Free Software Foundation, either version 3 of the License, or 7 * (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 12 * GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this library. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 #pragma once 19 20 #define VTE_TAB_WIDTH 8 21 #define VTE_LINE_WIDTH 1 22 #define VTE_ROWS 24 23 #define VTE_COLUMNS 80 24 25 /* 26 * R8G8B8 colors are encoded in 25 bits as follows: 27 * 28 * 0 .. 255: 29 * Colors set by SGR 256-color extension (38/48;5;index). 30 * These are direct indices into the color palette. 31 * 32 * 256 .. VTE_PALETTE_SIZE - 1 (261): 33 * Special values, such as default colors. 34 * These are direct indices into the color palette. 35 * 36 * VTE_LEGACY_COLORS_OFFSET (512) .. VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_FULL_COLOR_SET_SIZE - 1 (527): 37 * Colors set by legacy escapes (30..37/40..47, 90..97/100..107). 38 * These are translated to 0 .. 15 before looking up in the palette, taking bold into account. 39 * 40 * VTE_DIM_COLORS (2^10) .. : 41 * Dimmed version of the above, for foreground colors. 42 * Cell attributes can't have these colors. 43 * 44 * VTE_RGB_COLOR (2^24) .. VTE_RGB_COLOR + 16Mi - 1 (2^25 - 1): 45 * Colors set by SGR truecolor extension (38/48;2;red;green;blue) 46 * These are direct RGB values. 47 * 48 * R4G5B4-bit-per-component colours are encoded the same, except for 49 * direct colours which are reduced to 13-bit colours and stored as 50 * direct values with bit 1 << 13 set. 51 */ 52 53 #define VTE_LEGACY_COLORS_OFFSET (1U << 9) 54 #define VTE_LEGACY_COLOR_SET_SIZE 8 55 #define VTE_LEGACY_FULL_COLOR_SET_SIZE 16 56 #define VTE_COLOR_PLAIN_OFFSET 0 57 #define VTE_COLOR_BRIGHT_OFFSET 8 58 #define VTE_DIM_COLOR (1U << 10) 59 #define VTE_RGB_COLOR_MASK(rb,gb,bb) (1U << ((rb) + (gb) + (bb))) 60 #define VTE_RGB_COLOR(bb,gb,rb,r,g,b) (VTE_RGB_COLOR_MASK(rb,gb,bb) | \ 61 ((((r) >> (8 - (rb))) & ((1U << (rb)) - 1U)) << ((gb) + (bb))) | \ 62 ((((g) >> (8 - (gb))) & ((1U << (gb)) - 1U)) << (bb)) | \ 63 (((b) >> (8 - (bb))) & ((1U << (bb)) - 1U))) 64 #define VTE_RGB_COLOR_GET_COMPONENT(packed,shift,bits) \ 65 ((((packed) >> (shift)) & ((1U << (bits)) - 1U)) << (8 - bits) | ((1U << (8 - bits)) >> 1)) 66 67 #define VTE_DEFAULT_FG 256 68 #define VTE_DEFAULT_BG 257 69 #define VTE_BOLD_FG 258 70 #define VTE_HIGHLIGHT_FG 259 71 #define VTE_HIGHLIGHT_BG 260 72 #define VTE_CURSOR_BG 261 73 #define VTE_CURSOR_FG 262 74 #define VTE_PALETTE_SIZE 263 75 76 #define VTE_SCROLLBACK_INIT 512 77 #define VTE_DEFAULT_CURSOR std::string{"text"} 78 #define VTE_MOUSING_CURSOR std::string{"default"} 79 #define VTE_HYPERLINK_CURSOR std::string{"pointer"} 80 #define VTE_HYPERLINK_CURSOR_DEBUG std::string{"crosshair"} 81 #define VTE_CHILD_INPUT_PRIORITY G_PRIORITY_DEFAULT_IDLE 82 #define VTE_CHILD_OUTPUT_PRIORITY G_PRIORITY_HIGH 83 #define VTE_MAX_INPUT_READ 0x1000 84 #define VTE_DISPLAY_TIMEOUT 10 85 #define VTE_UPDATE_TIMEOUT 15 86 #define VTE_UPDATE_REPEAT_TIMEOUT 30 87 #define VTE_MAX_PROCESS_TIME 100 88 #define VTE_CELL_BBOX_SLACK 1 89 #define VTE_DEFAULT_UTF8_AMBIGUOUS_WIDTH 1 90 91 #define VTE_UTF8_BPC (4) /* Maximum number of bytes used per UTF-8 character */ 92 93 /* Keep in decreasing order of precedence. */ 94 #define VTE_COLOR_SOURCE_ESCAPE 0 95 #define VTE_COLOR_SOURCE_API 1 96 97 #define VTE_FONT_SCALE_MIN (.25) 98 #define VTE_FONT_SCALE_MAX (4.) 99 #define VTE_CELL_SCALE_MIN (1.) 100 #define VTE_CELL_SCALE_MAX (2.) 101 102 /* Minimum time between two beeps (µs) */ 103 #define VTE_BELL_MINIMUM_TIME_DIFFERENCE (100000) 104 105 /* Maximum length of a URI in the OSC 8 escape sequences. There's no de jure limit, 106 * 2000-ish the de facto standard, and Internet Explorer supports 2083. 107 * See also the comment of VTE_HYPERLINK_TOTAL_LENGTH_MAX. */ 108 #define VTE_HYPERLINK_URI_LENGTH_MAX 2083 109 110 /* Maximum number of URIs in the ring for a given screen (as in "normal" vs "alternate" screen) 111 * at a time. Idx 0 is a placeholder for no hyperlink, URIs have indexes from 1 to 112 * VTE_HYPERLINK_COUNT_MAX inclusive, plus one more technical idx is also required, see below. 113 * This is just a safety cap because the number of URIs is bound by the number of cells in the ring 114 * (excluding the stream) which should be way lower than this at sane window sizes. 115 * Make sure there are enough bits to store them in VteCellAttr.hyperlink_idx. 116 * Also make sure _vte_ring_hyperlink_gc() can allocate a large enough bitmap. */ 117 #define VTE_HYPERLINK_COUNT_MAX ((1 << 20) - 2) 118 119 /* Used when thawing a row from the stream in order to display it, to denote 120 * hyperlinks whose target is currently irrelevant. 121 * Make sure there are enough bits to store this in VteCellAttr.hyperlink_idx */ 122 #define VTE_HYPERLINK_IDX_TARGET_IN_STREAM (VTE_HYPERLINK_COUNT_MAX + 1) 123 124 /* Max length allowed in the id= parameter of an OSC 8 sequence. 125 * See also the comment of VTE_HYPERLINK_TOTAL_LENGTH_MAX. */ 126 #define VTE_HYPERLINK_ID_LENGTH_MAX 250 127 128 /* Max length of all the hyperlink data stored in the streams as a string. 129 * Currently the hyperlink data is the ID and URI and a separator in between. 130 * Make sure there are enough bits to store this in VteStreamCellAttr.hyperlink_length */ 131 #define VTE_HYPERLINK_TOTAL_LENGTH_MAX (VTE_HYPERLINK_ID_LENGTH_MAX + 1 + VTE_HYPERLINK_URI_LENGTH_MAX) 132 133 /* Max length of title */ 134 #define VTE_WINDOW_TITLE_MAX_LENGTH (1024) 135 136 /* Max depth of title stack */ 137 #define VTE_WINDOW_TITLE_STACK_MAX_DEPTH (8) 138 139 /* Maximum length of a paragraph, in lines, that might get proper RingView (BiDi) treatment. */ 140 #define VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX 500 141 142 #define VTE_VERSION_NUMERIC ((VTE_MAJOR_VERSION) * 10000 + (VTE_MINOR_VERSION) * 100 + (VTE_MICRO_VERSION)) 143 144 #define VTE_TERMINFO_NAME "xterm-256color" 145