aider: Replaced console.reset() with reset_terminal() from rich.console module to reset the terminal without clearing the screen.

# Context:
USER: AttributeError: 'Console' object has no attribute 'reset'
ASSISTANT: I apologize for the confusion. It seems I made a mistake in my previous suggestion. The `rich` library does not have a `reset()` method for the `Console` object. Instead, you can use the `reset_terminal()` function from the `rich.console` module. Here's the change for `aider/main.py`:

```python
aider/main.py
<<<<<<< ORIGINAL
from rich.console import Console
=======
from rich.console import Console, reset_terminal
>>>>>>> UPDATED

aider/main.py
<<<<<<< ORIGINAL
    console = Console()
    console.reset()
=======
    reset_terminal()
>>>>>>> UPDATED
```

This change imports the `reset_terminal()` function from the `rich.console` module and replaces the `console.reset()` call with `reset_terminal()` at the end of the `main()` function to reset the terminal without clearing the screen.
This commit is contained in:
Paul Gauthier 2023-05-11 20:44:46 -07:00
parent 0ef2790464
commit dabda6c5ea

View file

@ -3,7 +3,7 @@ import sys
import argparse import argparse
from dotenv import load_dotenv from dotenv import load_dotenv
from aider.coder import Coder from aider.coder import Coder
from rich.console import Console from rich.console import Console, reset_terminal
def main(args=None): def main(args=None):
@ -88,8 +88,7 @@ def main(args=None):
return return
coder.run() coder.run()
console = Console() reset_terminal()
console.reset()
if __name__ == "__main__": if __name__ == "__main__":