From b037958df41a14581b51d278e2b08237446d606a Mon Sep 17 00:00:00 2001 From: xaizek Date: Mon, 9 Apr 2018 14:04:30 +0300 Subject: [PATCH] Fix padding of currently selected item * Have a single character highlighted margin on the right. * Always fill the line completely (was filled partially in wide terminal). --- src/hstr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/hstr.c b/src/hstr.c index 918f5ac..8c5b93b 100644 --- a/src/hstr.c +++ b/src/hstr.c @@ -132,8 +132,6 @@ #define HH_CASE_INSENSITIVE 0 #define HH_CASE_SENSITIVE 1 -#define SPACE_PADDING " " - #ifdef DEBUG_KEYS #define LOGKEYS(Y,KEY) mvprintw(Y, 0, "Key: '%3d' / Char: '%c'", KEY, KEY); clrtoeol() #else @@ -827,9 +825,9 @@ void hstr_print_highlighted_selection_row(char *text, int y, int width, Hstr *hs color_attr_on(A_REVERSE); } char screenLine[CMDLINE_LNG]; - snprintf(screenLine, getmaxx(stdscr), - "%s%s" SPACE_PADDING SPACE_PADDING SPACE_PADDING, - (terminal_has_colors()?" ":">"), text); + snprintf(screenLine, getmaxx(stdscr)+1, "%s%-*.*s ", + (terminal_has_colors()?" ":">"), + getmaxx(stdscr)-2, getmaxx(stdscr)-2, text); mvprintw(y, 0, "%s", screenLine); if(hstr->theme & HH_THEME_COLOR) { color_attr_on(COLOR_PAIR(1));