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"
22 struct lineprefix line_prefixes[] = {
23 [LINE_TEXT] = { "", "" },
24 [LINE_LINK] = { "=> ", " " },
25 [LINE_TITLE_1] = { "# ", " " },
26 [LINE_TITLE_2] = { "## ", " " },
27 [LINE_TITLE_3] = { "### ", " " },
28 [LINE_ITEM] = { "* ", " " },
29 [LINE_QUOTE] = { "> ", " " },
30 [LINE_PRE_START] = { "```", " " },
31 [LINE_PRE_CONTENT] = { "", "" },
32 [LINE_PRE_END] = { "```", "```" },
35 struct line_face line_faces[] = {
36 [LINE_TEXT] = { 0, 0 },
37 [LINE_LINK] = { 0, A_UNDERLINE },
38 [LINE_TITLE_1] = { A_BOLD, A_BOLD },
39 [LINE_TITLE_2] = { A_BOLD, A_BOLD },
40 [LINE_TITLE_3] = { A_BOLD, A_BOLD },
41 [LINE_ITEM] = { 0, 0 },
42 [LINE_QUOTE] = { 0, A_DIM },
43 [LINE_PRE_START] = { 0, 0 },
44 [LINE_PRE_CONTENT] = { 0, 0 },
45 [LINE_PRE_END] = { 0, 0 },
48 struct tab_face tab_face = {
49 .background = A_REVERSE,
51 .current_tab = A_NORMAL,
54 struct modeline_face modeline_face = {
55 .background = A_REVERSE,
58 struct minibuffer_face minibuffer_face = {
59 .background = A_NORMAL,
63 config_setprfx(const char *name, int cont, const char *str)
73 {"title1", LINE_TITLE_1},
74 {"title2", LINE_TITLE_2},
75 {"title3", LINE_TITLE_3},
77 {"quote", LINE_QUOTE},
78 {"pre.start", LINE_PRE_START},
79 {"pre", LINE_PRE_CONTENT},
80 {"pre.end", LINE_PRE_END},
83 if (!has_prefix(name, "line."))
87 for (i = 0; i < sizeof(mappings)/sizeof(mappings[0]); ++i) {
88 if (!strcmp(name, mappings[i].label)) {
89 name += strlen(mappings[i].label);
90 p = &line_prefixes[mappings[i].id];