Add inline code support.
authorFreeBirdLjj <ljj11011@mail.ustc.edu.cn>
Sat, 20 Sep 2014 11:33:14 +0000 (19:33 +0800)
committerFreeBirdLjj <ljj11011@mail.ustc.edu.cn>
Sat, 20 Sep 2014 11:33:14 +0000 (19:33 +0800)
viewer.c

index e31dbcb..f5e43d4 100644 (file)
--- 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
                     }
                 }