cgmnlm

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/cgmnlm.git
Log | Files | Refs | README | LICENSE

commit 9ef33fb102426d0bf56e93ceebcd81eb24171a9e
parent 0ed7a4527c967ce3f14909923277cf62624f0900
Author: René Wagner <rwagner@rw-net.de>
Date:   Fri,  8 Jan 2021 21:46:27 +0100

minor rendering adjustments

Diffstat:
MREADME.md | 2+-
Msrc/gmnlm.c | 27+++++++++++++--------------
2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md @@ -28,7 +28,7 @@ The actual colors used depend on your terminal palette: - gemini link on same capsule: light cyan - gemini link to another capsule: dark cyan - non-gemini link: light magenta -- quote: light gray +- preformatted text: light gray Besides this rendering adjustments i'll try to keep track of upstream changes or send patches to upstream. diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -23,7 +23,7 @@ #define ANSI_COLOR_GREEN "\x1b[92m" #define ANSI_COLOR_YELLOW "\x1b[93m" #define ANSI_COLOR_BLUE "\x1b[94m" -#define ANSI_COLOR_MAGENTA "\x1b[95m" +#define ANSI_COLOR_MAGENTA "\x1b[35m" #define ANSI_COLOR_CYAN "\x1b[36m" #define ANSI_COLOR_LCYAN "\x1b[96m" #define ANSI_COLOR_GRAY "\x1b[37m" @@ -70,7 +70,7 @@ enum prompt_result { const char *default_bookmarks = "# Welcome to cgmnlm\n\n" "Links:\n\n" - "=> https://src.clttr.info/rwa/cgmnlm The cgmnlm browser\n" + "=> https://gmn.clttr.info/cgmnln.gmi The colorful line mode client\n" "=> gemini://gemini.circumlunar.space The gemini protocol\n\n" "This file can be found at %s and may be edited at your pleasure.\n\n" "Bookmarks:\n" @@ -809,20 +809,20 @@ display_gemini(struct browser *browser, struct gemini_response *resp) repeat: switch (tok.token) { case GEMINI_TEXT: - col += fprintf(out, " "); + col += fprintf(out, " "); if (text == NULL) { text = tok.text; } break; case GEMINI_LINK: if (text == NULL) { - col += fprintf(out, "%2d) %s", nlinks++, (!strncmp("gemini://", tok.link.url, 9)) ? ANSI_COLOR_CYAN : ((strstr(tok.link.url, "://") == NULL) ? ANSI_COLOR_LCYAN : ANSI_COLOR_MAGENTA)); + col += fprintf(out, "%3d) %s", nlinks++, (!strncmp("gemini://", tok.link.url, 9)) ? ANSI_COLOR_CYAN : ((strstr(tok.link.url, "://") == NULL) ? ANSI_COLOR_LCYAN : ANSI_COLOR_MAGENTA)); text = trim_ws(tok.link.text ? tok.link.text : tok.link.url); *next = calloc(1, sizeof(struct link)); (*next)->url = strdup(trim_ws(tok.link.url)); next = &(*next)->next; } else { - col += fprintf(out, " "); + col += fprintf(out, " "); } break; case GEMINI_PREFORMATTED_BEGIN: @@ -832,7 +832,7 @@ repeat: continue; // Not used case GEMINI_PREFORMATTED_TEXT: if (text == NULL) { - fprintf(out, " "); + fprintf(out, " %s", ANSI_COLOR_GRAY); text = tok.preformatted; } break; @@ -843,32 +843,31 @@ repeat: if (text == NULL) { switch (tok.heading.level) { case 1: - col += fprintf(out, "%s%s", " # ", ANSI_COLOR_RED); + col += fprintf(out, " # %s", ANSI_COLOR_RED); break; case 2: - col += fprintf(out, "%s%s", " ## ", ANSI_COLOR_YELLOW); + col += fprintf(out, " ## %s", ANSI_COLOR_YELLOW); break; case 3: - col += fprintf(out, "%s%s", "### ", ANSI_COLOR_GREEN); + col += fprintf(out, " ### %s", ANSI_COLOR_GREEN); break; } text = trim_ws(tok.heading.title); } else { - col += fprintf(out, " "); + col += fprintf(out, " "); } break; case GEMINI_LIST_ITEM: if (text == NULL) { - col += fprintf(out, " %s ", + col += fprintf(out, " %s ", browser->unicode ? "•" : "*"); text = trim_ws(tok.list_item); } else { - col += fprintf(out, " "); + col += fprintf(out, " "); } break; case GEMINI_QUOTE: - col += fprintf(out, " %s%s %s", ANSI_COLOR_RESET, - browser->unicode ? "┃" : ">", ANSI_COLOR_GRAY); + col += fprintf(out, " %s ", browser->unicode ? "┃" : ">"); if (text == NULL) { text = trim_ws(tok.quote_text); }