2 * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include "telescope.h"
24 char *new_tab_url = NULL;
25 int fill_column = INT_MAX;
27 struct lineprefix line_prefixes[] = {
28 [LINE_TEXT] = { "", "" },
29 [LINE_LINK] = { "=> ", " " },
30 [LINE_TITLE_1] = { "# ", " " },
31 [LINE_TITLE_2] = { "## ", " " },
32 [LINE_TITLE_3] = { "### ", " " },
33 [LINE_ITEM] = { "* ", " " },
34 [LINE_QUOTE] = { "> ", " " },
35 [LINE_PRE_START] = { "```", " " },
36 [LINE_PRE_CONTENT] = { "", "" },
37 [LINE_PRE_END] = { "```", "```" },
40 struct line_face line_faces[] = {
41 [LINE_TEXT] = { 0, 0 },
42 [LINE_LINK] = { 0, A_UNDERLINE },
43 [LINE_TITLE_1] = { A_BOLD, A_BOLD },
44 [LINE_TITLE_2] = { A_BOLD, A_BOLD },
45 [LINE_TITLE_3] = { A_BOLD, A_BOLD },
46 [LINE_ITEM] = { 0, 0 },
47 [LINE_QUOTE] = { 0, A_DIM },
48 [LINE_PRE_START] = { 0, 0 },
49 [LINE_PRE_CONTENT] = { 0, 0 },
50 [LINE_PRE_END] = { 0, 0 },
53 struct tab_face tab_face = {
54 .background = A_REVERSE,
56 .current_tab = A_NORMAL,
59 struct modeline_face modeline_face = {
60 .background = A_REVERSE,
63 struct minibuffer_face minibuffer_face = {
64 .background = A_NORMAL,
68 config_setprfx(const char *name, int cont, const char *str)
78 {"title1", LINE_TITLE_1},
79 {"title2", LINE_TITLE_2},
80 {"title3", LINE_TITLE_3},
82 {"quote", LINE_QUOTE},
83 {"pre.start", LINE_PRE_START},
84 {"pre", LINE_PRE_CONTENT},
85 {"pre.end", LINE_PRE_END},
88 if (!has_prefix(name, "line."))
92 for (i = 0; i < sizeof(mappings)/sizeof(mappings[0]); ++i) {
93 if (!strcmp(name, mappings[i].label)) {
94 name += strlen(mappings[i].label);
95 p = &line_prefixes[mappings[i].id];
110 config_setvari(const char *var, int val)
112 if (!strcmp(var, "fill-column")) {
121 config_setvars(const char *var, char *val)
123 if (!strcmp(var, "new-tab-url")) {
124 if (new_tab_url != NULL)