Skip to content

Commit

Permalink
Fix double space between question and instructions in prompts (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSchott committed Dec 3, 2020
1 parent 146e320 commit b28cb51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions questionary/prompts/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_prompt_tokens() -> List[Tuple[str, str]]:
if ic.is_answered:
nbr_selected = len(ic.selected_options)
if nbr_selected == 0:
tokens.append(("class:answer", " done"))
tokens.append(("class:answer", "done"))
elif nbr_selected == 1:
if isinstance(ic.get_selected_values()[0].title, list):
ts = ic.get_selected_values()[0].title
Expand All @@ -105,18 +105,18 @@ def get_prompt_tokens() -> List[Tuple[str, str]]:
tokens.append(
(
"class:answer",
" [{}]".format(ic.get_selected_values()[0].title),
"[{}]".format(ic.get_selected_values()[0].title),
)
)
else:
tokens.append(
("class:answer", " done ({} selections)".format(nbr_selected))
("class:answer", "done ({} selections)".format(nbr_selected))
)
else:
tokens.append(
(
"class:instruction",
" (Use arrow keys to move, "
"(Use arrow keys to move, "
"<space> to select, "
"<a> to toggle, "
"<i> to invert)",
Expand Down
4 changes: 2 additions & 2 deletions questionary/prompts/confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def get_prompt_tokens():
tokens.append(("class:question", " {} ".format(message)))

if status["answer"] is not None:
answer = " {}".format(YES if status["answer"] else NO)
answer = YES if status["answer"] else NO
tokens.append(("class:answer", answer))
else:
instruction = " {}".format(YES_OR_NO if default else NO_OR_YES)
instruction = YES_OR_NO if default else NO_OR_YES
tokens.append(("class:instruction", instruction))

return to_formatted_text(tokens)
Expand Down
8 changes: 4 additions & 4 deletions questionary/prompts/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ def get_prompt_tokens():
)
)
else:
tokens.append(("class:answer", " " + ic.get_pointed_at().title))
tokens.append(("class:answer", ic.get_pointed_at().title))
else:
if instruction:
tokens.append(("class:instruction", instruction))
else:
if use_shortcuts and use_arrow_keys:
instruction_msg = " (Use shortcuts or arrow keys)"
instruction_msg = "(Use shortcuts or arrow keys)"
elif use_shortcuts and not use_arrow_keys:
instruction_msg = " (Use shortcuts)"
instruction_msg = "(Use shortcuts)"
else:
instruction_msg = " (Use arrow keys)"
instruction_msg = "(Use arrow keys)"
tokens.append(("class:instruction", instruction_msg))

return tokens
Expand Down

0 comments on commit b28cb51

Please sign in to comment.