mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
refactor: simplify _get_style method in InputOutput class
This commit is contained in:
parent
d3908ca971
commit
ede3cbb372
1 changed files with 20 additions and 14 deletions
34
aider/io.py
34
aider/io.py
|
@ -251,26 +251,32 @@ class InputOutput:
|
||||||
else:
|
else:
|
||||||
self.console = Console(force_terminal=False, no_color=True) # non-pretty
|
self.console = Console(force_terminal=False, no_color=True) # non-pretty
|
||||||
|
|
||||||
def _get_style(self, style_dict=None):
|
def _get_style(self):
|
||||||
if style_dict is None:
|
style_dict = {}
|
||||||
style_dict = {}
|
if not self.pretty:
|
||||||
if self.pretty and self.user_input_color:
|
return Style.from_dict(style_dict)
|
||||||
|
|
||||||
|
if self.user_input_color:
|
||||||
style_dict.setdefault("", self.user_input_color)
|
style_dict.setdefault("", self.user_input_color)
|
||||||
style_dict.update(
|
style_dict.update(
|
||||||
{
|
{
|
||||||
"pygments.literal.string": f"bold italic {self.user_input_color}",
|
"pygments.literal.string": f"bold italic {self.user_input_color}",
|
||||||
"completion-menu": (
|
|
||||||
f"bg:{self.completion_menu_bg_color} {self.completion_menu_color}"
|
|
||||||
),
|
|
||||||
"completion-menu.completion.current": (
|
|
||||||
f"bg:{self.completion_menu_current_bg_color} "
|
|
||||||
f"{self.completion_menu_current_color}"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return Style.from_dict(style_dict)
|
|
||||||
else:
|
style_dict.update(
|
||||||
return {}
|
{
|
||||||
|
"completion-menu": (
|
||||||
|
f"bg:{self.completion_menu_bg_color} {self.completion_menu_color}"
|
||||||
|
),
|
||||||
|
"completion-menu.completion.current": (
|
||||||
|
f"bg:{self.completion_menu_current_bg_color} "
|
||||||
|
f"{self.completion_menu_current_color}"
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return Style.from_dict(style_dict)
|
||||||
|
|
||||||
def read_image(self, filename):
|
def read_image(self, filename):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue