Skip to content

Commit

Permalink
⚡ Short prompt output length
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Aug 30, 2023
1 parent 757de81 commit 98a46b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addon-info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "translate-shell",
"description": "Translate text by google, bing, youdaozhiyun, haici, stardict, openai, large language model of local machine, etc at same time from CLI, GUI (GNU/Linux, Android, macOS and Windows), REPL, python, shell and vim.",
"version": "0.0.34",
"version": "0.0.35",
"author": "Wu Zhenyu <wuzhenyu@ustc.edu>",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "translate-shell",
"version": "0.0.34",
"version": "0.0.35",
"description": "Translate text by google, bing, youdaozhiyun, haici, stardict, openai, large language model of local machine, etc at same time from CLI, GUI (GNU/Linux, Android, macOS and Windows), REPL, python, shell and vim.",
"author": "Wu Zhenyu <wuzhenyu@ustc.edu>",
"license": "GPLv3"
Expand Down
11 changes: 9 additions & 2 deletions src/translate_shell/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,15 @@ def p10k_sections(
raise NotImplementedError(f"{type(action)} is not supported!")
text = insert_text.format(text=text)
if last_bg:
prompt += getattr(Fore, last_bg) + getattr(Back, bg) + sep
prompt += getattr(Fore, fg) + getattr(Back, bg) + text
prompt += (
getattr(Fore, last_bg)
+ getattr(Back, bg)
+ sep
+ getattr(Fore, fg)
+ text
)
else:
prompt += getattr(Fore, fg) + getattr(Back, bg) + text
last_bg = bg
prompt += getattr(Fore, last_bg) + Back.RESET + sep + Style.RESET_ALL
return prompt

0 comments on commit 98a46b9

Please sign in to comment.