mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
refactor: centralize completion menu styles in _get_style method to reduce code duplication
This commit is contained in:
parent
cf46d9cdd0
commit
bff1b3de9c
1 changed files with 8 additions and 11 deletions
19
aider/io.py
19
aider/io.py
|
@ -257,6 +257,13 @@ class InputOutput:
|
||||||
style_dict = {"": self.user_input_color}
|
style_dict = {"": self.user_input_color}
|
||||||
else:
|
else:
|
||||||
style_dict.setdefault("", self.user_input_color)
|
style_dict.setdefault("", self.user_input_color)
|
||||||
|
# Add the completion menu styles
|
||||||
|
style_dict.update({
|
||||||
|
"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} {self.completion_menu_current_color}"
|
||||||
|
),
|
||||||
|
})
|
||||||
return Style.from_dict(style_dict)
|
return Style.from_dict(style_dict)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
@ -340,10 +347,6 @@ class InputOutput:
|
||||||
|
|
||||||
style_dict = {
|
style_dict = {
|
||||||
"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} {self.completion_menu_current_color}"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
style = self._get_style(style_dict)
|
style = self._get_style(style_dict)
|
||||||
|
|
||||||
|
@ -485,13 +488,7 @@ class InputOutput:
|
||||||
else:
|
else:
|
||||||
self.tool_output(subject, bold=True)
|
self.tool_output(subject, bold=True)
|
||||||
|
|
||||||
style_dict = {
|
style = self._get_style()
|
||||||
"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} {self.completion_menu_current_color}"
|
|
||||||
),
|
|
||||||
}
|
|
||||||
style = self._get_style(style_dict)
|
|
||||||
if style is None:
|
if style is None:
|
||||||
style = {}
|
style = {}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue