diff options
author | GinjaNinja32 <ginjaninja32@gmail.com> | 2017-10-06 20:35:29 +0100 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2018-01-18 10:08:00 +0100 |
commit | 13b93c8c05dafd4f45ca7153ae165d6afd0ba157 (patch) | |
tree | 1df87c0c4dfbc20684454295e0b238c8d160af08 | |
parent | 925ae6e6adfae0b8924cfeca2a2b0ac99b042bce (diff) | |
download | irssi-13b93c8c05dafd4f45ca7153ae165d6afd0ba157.zip |
Apply changes based on review feedback
-rw-r--r-- | src/fe-text/gui-entry.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index 3e275e34..27eaa540 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -242,7 +242,6 @@ static void gui_entry_fix_cursor(GUI_ENTRY_REC *entry) static void gui_entry_draw_from(GUI_ENTRY_REC *entry, int pos) { int i; - const int *col; int xpos, end_xpos, color; xpos = entry->xpos + entry->promptlen + @@ -257,10 +256,9 @@ static void gui_entry_draw_from(GUI_ENTRY_REC *entry, int pos) term_set_color(root_window, ATTR_RESET); term_move(root_window, xpos, entry->ypos); - col = entry->scrstart + pos < entry->text_len ? - entry->colors + entry->scrstart + pos : 0; - for (i = entry->scrstart + pos; i < entry->text_len; i++, col++) { + for (i = entry->scrstart + pos; i < entry->text_len; i++) { unichar c = entry->text[i]; + int col = entry->colors[i]; if (entry->hidden) xpos++; @@ -274,9 +272,9 @@ static void gui_entry_draw_from(GUI_ENTRY_REC *entry, int pos) if (xpos > end_xpos) break; - if (*col != color) { - term_set_color(root_window, *col); - color = *col; + if (col != color) { + term_set_color(root_window, col); + color = col; } if (entry->hidden) @@ -522,7 +520,7 @@ void gui_entry_insert_text(GUI_ENTRY_REC *entry, const char *str) } } - for(i = 0; i < len; i++) { + for (i = 0; i < len; i++) { entry->colors[entry->pos + i] = ATTR_RESET; } @@ -915,7 +913,6 @@ void gui_entry_transpose_words(GUI_ENTRY_REC *entry) g_free(first_color); g_free(sep_color); g_free(second_color); - } gui_entry_redraw_from(entry, spos1); @@ -1106,7 +1103,7 @@ void gui_entry_redraw(GUI_ENTRY_REC *entry) void gui_entry_set_color(GUI_ENTRY_REC *entry, int pos, int len, int color) { - int i, end, update = 0; + int i, end, update = FALSE; g_return_if_fail(entry != NULL); @@ -1121,7 +1118,7 @@ void gui_entry_set_color(GUI_ENTRY_REC *entry, int pos, int len, int color) for (i = pos; i < end; i++) { if (entry->colors[i] != color) { entry->colors[i] = color; - update = 1; + update = TRUE; } } |