From 941912538716e541c9c6a291a2cbca1cacc36f82 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 22 Jan 2022 11:45:01 +0530 Subject: [PATCH] Highlight the default choice in yellow --- kittens/ask/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kittens/ask/main.py b/kittens/ask/main.py index 063894366..6f39e5a22 100644 --- a/kittens/ask/main.py +++ b/kittens/ask/main.py @@ -150,8 +150,8 @@ def __init__(self, cli_opts: AskCLIOptions) -> None: else: allowed = [] for choice in cli_opts.choices: - color = 'green' letter, text = choice.split(':', maxsplit=1) + color = '' if ';' in letter: letter, color = letter.split(';', maxsplit=1) letter = letter.lower() @@ -215,7 +215,8 @@ def commit_line(end: str = '\r\n') -> None: for letter, choice in self.choices.items(): text = choice.text[:choice.idx] - text += styled(choice.text[choice.idx], fg=choice.color) + color = choice.color or ('yellow' if letter == self.response else 'green') + text += styled(choice.text[choice.idx], fg=color) text += choice.text[choice.idx + 1:] text += ' ' sz = wcswidth(text)