From bf170a02ce6aa73599c2112f7265b9a7f40547b8 Mon Sep 17 00:00:00 2001 From: ElectricAlchemist Date: Wed, 23 Oct 2019 00:32:45 +0200 Subject: [PATCH] white theme and tab highlight --- Makefile | 4 ++-- hello | 5 +++++ ste | Bin 18344 -> 22112 bytes ste.c | 31 +++++++++++++++++++++++-------- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index fbb35b7..430d314 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC=gcc CFLAGS=-Wall -Wextra -pedantic -Werror OFLAGS=-O3 -LFLAGS=-lncurses +LFLAGS=-lncursesw ste: ste.c - $(CC) $(CFLAGS) $(OFLAGS) $(LFLAGS) -o ste $^ \ No newline at end of file + $(CC) $(CFLAGS) $(OFLAGS) $(LFLAGS) -o ste $^ diff --git a/hello b/hello index f35d3e6..e4476b0 100644 --- a/hello +++ b/hello @@ -1 +1,6 @@ hello world +hello + hello + hello + hello + hello diff --git a/ste b/ste index 56fff7d58c480f1848a0b2192c5c359d77eeb418..6d9d99af470ef0b384dd32179a11e0f2552b25e6 100755 GIT binary patch literal 22112 zcmeHPeRx#WnLm@sK!PMUAcOG(88x(^5)%X@NHh~BaMLCjKBcuX4D&%!lbLj8A|FLe z9iWcafwZ-jcHJ$t`?$5ceHQy{sb#y81SLu>Myf0=RZ?2*3{*{RMZ}WX-+S&k$(>1V zpYA{V?Cvw?dFH(5{kuJrCA3EXlK2m`ql72P3ZOS{ zA`p_wcv4L0_q=FNHg!QpNmA0K)bv)=N99g&T-mgNYcVFNv|A24YUkgYM0nW>QJ+~{ zW{UPpDh`+3(%Q1&mR8^F)|Oz$=GmJU%%44fZh0hBJ_ik;Hci2gLb-I=YBv9t#L?&W zBoBY*%`cxhy!jRDTi^J~O{7C@Ab+GoiS$KvoL&!}R-wKk5@bM;oicIi_P5dk{(cfdDpEkiSn&33d zIPl9(KL#+?@%EeG>rC*wflp#rGRJZhkmPt(gX5CdmM#%FuJfR`BOLKZ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ME(fo6R5OLy4&9dm6w` zPVS%P6{R>X9HQQ0{Gj_IS9b18r2Hyfs1^ek*NJ?&h_#5~{&TL?Ey@ZU3Pkoln=e-h diff --git a/ste.c b/ste.c index a7f7b0a..4827ff5 100644 --- a/ste.c +++ b/ste.c @@ -4,7 +4,7 @@ /* defines */ #define CTRL(k) ((k) & 0x1f) // Control mask modifier -#define TABSIZE 4 // Tab size as used in render +#define TABSIZE 8 // Tab size as used in render /* main data structure containing: * -cursor position @@ -154,7 +154,11 @@ void termInit (void) /* Start color mode */ start_color(); - init_pair(1, COLOR_BLUE, COLOR_BLACK); + init_pair(2, COLOR_BLACK, COLOR_CYAN); + init_pair(1, COLOR_BLACK, COLOR_WHITE); + + /* Set default color */ + bkgd(COLOR_PAIR(1)); /* Populate the main data structure */ getmaxyx(stdscr, t.dim.y, t.dim.x); @@ -187,6 +191,7 @@ void termExit (void) void termDie (char *s) { + erase(); refresh(); endwin(); perror(s); @@ -223,15 +228,20 @@ void drawLines (void) ln = i + t.cur.off_y; /* Draw the line number */ - attron(COLOR_PAIR(1)); + attron(COLOR_PAIR(2)); mvprintw(i, 0, "%d", ln + 1); - attroff(COLOR_PAIR(1)); + attroff(COLOR_PAIR(2)); lnMove(i, 0); + + if (ln == t.cur.y + t.cur.off_y) attron(COLOR_PAIR(2)); /* Draw the line matcing render memory */ if (rows.rw[ln].r_size >= t.cur.off_x) { addnstr(&rows.rw[ln].render[t.cur.off_x], t.dim.x + 1 - rows.rw[ln].delta); } + + attroff(COLOR_PAIR(2)); + lnMove(++line, 0); } lnMove(t.cur.y, t.cur.x); @@ -258,7 +268,7 @@ void drawBar (char *s) mvaddch(t.dim.y, i, ' '); char m[10]; - sprintf(m, "Zoom:\t%c", whatsThat()); + sprintf(m, "Zoom: %c", whatsThat()); mvaddstr(t.dim.y, t.dim.x + t.pad - strlen(m), m); /* Return to normal contrast mode */ @@ -340,8 +350,10 @@ void updateRender (row *rw) int off = 0; for (i = 0; i < rw->size; i++) { if (rw->chars[i] == '\t') { - for (int j = 0; j < TABSIZE; j++) - rw->render[off++] = ' '; + for (int j = 0; j < TABSIZE; j++){ + if (!j) rw->render[off++] = '|'; + else rw->render[off++] = ' '; + } } else { rw->render[off++] = rw->chars[i]; } @@ -457,6 +469,9 @@ int whatsThat (void) { case (' '): return '~'; break; + case ('\0'): + return '.'; + break; default: return c; break; @@ -473,4 +488,4 @@ void updateInfo (void) t.dim.x -= t.pad + 1; } -/*--------------------------------- testing ------------------------------------*/ \ No newline at end of file +/*--------------------------------- testing ------------------------------------*/