From 51dd9e7e6ebb7538920fcc5125ed13989c603366 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 21 Nov 2019 21:01:49 +0100 Subject: [PATCH] [color] Revert changes related to leading and trailing spaces and colours It did not look good. --- src/terminal/draw.c | 11 ----------- src/terminal/draw.h | 3 --- src/viewer/text/draw.c | 38 +++----------------------------------- 3 files changed, 3 insertions(+), 49 deletions(-) diff --git a/src/terminal/draw.c b/src/terminal/draw.c index a1d7b639..f98591cb 100644 --- a/src/terminal/draw.c +++ b/src/terminal/draw.c @@ -141,17 +141,6 @@ draw_char_data(struct terminal *term, int x, int y, unsigned char data) set_screen_dirty(term->screen, y, y); } -void -draw_space(struct terminal *term, int x, int y, struct screen_char *color) -{ - struct screen_char *screen_char = get_char(term, x, y); - - if (!screen_char) return; - - screen_char->data = ' '; - if (color) screen_char->c = color->c; -} - /*! Used by viewer to copy over a document. * When doing frame drawing @a x can be different than 0. */ void diff --git a/src/terminal/draw.h b/src/terminal/draw.h index 3995be4a..4d802d00 100644 --- a/src/terminal/draw.h +++ b/src/terminal/draw.h @@ -260,9 +260,6 @@ void draw_char(struct terminal *term, int x, int y, struct color_pair *color); #endif /* CONFIG_UTF8 */ -void draw_space(struct terminal *term, int x, int y, - struct screen_char *color); - /** Draws area defined by @a box using the same colors and attributes. */ void draw_box(struct terminal *term, struct el_box *box, unsigned char data, enum screen_char_attr attr, diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 07b3f49f..749a7828 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -203,8 +203,6 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active) struct view_state *vs; struct terminal *term; struct el_box *box; - struct screen_char *last = NULL; - int vx, vy; int y; @@ -289,43 +287,13 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active) for (y = int_max(vy, 0); y < int_min(doc_view->document->height, box->height + vy); y++) { - struct screen_char *first = NULL; - int i, j; - int last_index = 0; int st = int_max(vx, 0); int en = int_min(doc_view->document->data[y].length, box->width + vx); - int max = int_min(en, st + 200); - if (en - st > 0) { - draw_line(term, box->x + st - vx, box->y + y - vy, - en - st, - &doc_view->document->data[y].chars[st]); - - for (i = en - 1; i >= 0; --i) { - if (doc_view->document->data[y].chars[i].data != ' ') { - last = &doc_view->document->data[y].chars[i]; - last_index = i + 1; - break; - } - } - } - for (i = st; i < max; i++) { - if (doc_view->document->data[y].chars[i].data != ' ') { - first = &doc_view->document->data[y].chars[i]; - break; - } - } - - for (j = st; j < i; j++) { - draw_space(term, box->x + j - vx, box->y + y - vy, - first); - } - - for (i = last_index; i < box->width + vx; i++) { - draw_space(term, box->x + i - vx, box->y + y - vy, - last); - } + if (en - st <= 0) continue; + draw_line(term, box->x + st - vx, box->y + y - vy, en - st, + &doc_view->document->data[y].chars[st]); } draw_view_status(ses, doc_view, active); if (has_search_word(doc_view))