From 850fb843570835833f053a003f3d7f85872a6fb3 Mon Sep 17 00:00:00 2001 From: FreeBirdLjj Date: Sat, 20 Sep 2014 19:33:14 +0800 Subject: [PATCH] Add inline code support. --- viewer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/viewer.c b/viewer.c index e31dbcb..f5e43d4 100644 --- a/viewer.c +++ b/viewer.c @@ -363,7 +363,7 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert) { void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colors) { int i = 0; // increment char *c; // char pointer for iteration - char *special = "\\*_"; // list of interpreted chars + char *special = "\\*_`"; // list of interpreted chars cstack_t *stack = cstack_init(); if(line->text->text) { @@ -450,6 +450,10 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo case '_': wattroff(window, A_UNDERLINE); break; + // disable inline code + case '`': + wattroff(window, A_REVERSE); + break; } // remove top special char from stack @@ -474,6 +478,10 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo case '_': wattron(window, A_UNDERLINE); break; + // enable inline code + case '`': + wattron(window, A_REVERSE); + break; // do nothing for backslashes } @@ -505,6 +513,10 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo case '_': wattroff(window, A_UNDERLINE); break; + // disable inline code + case '`': + wattroff(window, A_REVERSE); + break; // do nothing for backslashes } } -- 2.20.1