Commit graph

24 commits

Author SHA1 Message Date
Paul Gauthier
ca45db2898 use utf-8 2023-07-05 20:51:35 -07:00
Paul Gauthier
8999c3fd97 move the progress bar to the bottom 2023-06-27 14:58:15 -07:00
Paul Gauthier
33cc72a0df ssh 2023-06-25 21:40:08 -07:00
Paul Gauthier
819b8b2672 tolerate missing final newline 2023-06-25 21:27:18 -07:00
Paul Gauthier
58690da8b4 fences are obfuscated so aider can modify itself 2023-06-25 20:55:10 -07:00
Paul Gauthier
0520981135 Attempt to quote diffs safely 2023-06-25 20:42:47 -07:00
Paul Gauthier
e5ad9d501f aider: Added extra backticks to the start and end of the show variable to ensure proper formatting.
# Context:
USER: do the todo
ASSISTANT: To complete the TODO task in the `diff_partial_update` function, I will find the longest string of backticks (`) that start a line in the `diff` variable. I will then add one more backtick to the start and end of the `show` variable to ensure proper formatting.

Here are the changes:

```python
aider/diffs.py
<<<<<<< ORIGINAL
    for line in diff:
        pass

    diff = "".join(diff)
    if not diff.endswith("\n"):
        diff += "\n"

    show = "```diff\n"
=======
    max_backticks = max(len(line) - len(line.lstrip("`")) for line in diff.splitlines())
    extra_backticks = "`" * (max_backticks + 1)

    diff = "".join(diff)
    if not diff.endswith("\n"):
        diff += "\n"

    show = f"{extra_backticks}diff\n"
>>>>>>> UPDATED
```

```python
aider/diffs.py
<<<<<<< ORIGINAL
    show += diff + "```\n\n"
=======
    show += diff + f"{extra_backticks}\n\n"
>>>>>>> UPDATED
```

These changes will find the longest string of backticks at the start of a line in the `diff` variable and add one more backtick to the start and end of the `show` variable.
2023-06-25 20:38:46 -07:00
Paul Gauthier
3393f560fb make sure diffs display with newlines 2023-06-25 17:33:33 -07:00
Paul Gauthier
64dcfefbec avoid div by zero 2023-06-24 10:29:36 -07:00
Paul Gauthier
4caec8dec1 reformat diff output header 2023-06-22 17:34:18 -07:00
Paul Gauthier
b5a92896ab Move the fname inside the unified diff block 2023-06-22 11:44:54 -07:00
Paul Gauthier
f9086e66d3 better live output of multi file edits 2023-06-21 21:02:07 -07:00
Paul Gauthier
99c86ccddf aider: Updated diff_partial_update function to include 5 lines of context in unified_diff function call.
# Context:
USER: expand the context diff to 5 lines of context
ASSISTANT: To expand the context diff to 5 lines of context, you need to modify the `diff_partial_update` function in the `aider/diffs.py` file. Update the `unified_diff` function call to include the `n` parameter with a value of 5.

Here's the change:

```python
aider/diffs.py
<<<<<<< ORIGINAL
    diff = difflib.unified_diff(lines_orig, lines_updated)
=======
    diff = difflib.unified_diff(lines_orig, lines_updated, n=5)
>>>>>>> UPDATED
```
2023-06-06 18:13:36 -07:00
Paul Gauthier
8f70f1b251 renamed 2023-06-05 22:34:44 -07:00
Paul Gauthier
8afae8b38f prettier 2023-06-05 21:57:22 -07:00
Paul Gauthier
6081baa32b better 2023-06-05 21:37:56 -07:00
Paul Gauthier
2336af2886 better 2023-06-05 19:41:14 -07:00
Paul Gauthier
2f0d9279d2 works 2023-06-05 19:36:12 -07:00
Paul Gauthier
78782e2d90 better 2023-06-05 16:59:11 -07:00
Paul Gauthier
67121a9834 aider: Added function to print unified diff and find last non-deleted line.
# Context:
USER: do the todo
2023-06-05 16:47:52 -07:00
Paul Gauthier
2f684bf99e cleanup 2023-06-05 16:46:38 -07:00
Paul Gauthier
33d1a43845 initial 2023-06-05 16:42:36 -07:00
Paul Gauthier
efb903303f aider: Added diff_files.py script that reads two file names from the command line, reads the contents of the files, and then uses the difflib module to print their differences.
# Context:
USER: read 2 files named on the cmd line, use difflib to print their differences
ASSISTANT: To achieve this, we'll create a new Python script that reads two file names from the command line, reads the contents of the files, and then uses the `difflib` module to print their differences.

1. Create a new Python script called `diff_files.py` in the `aider` directory.
2. Import the necessary modules: `sys` and `difflib`.
3. Read the file names from the command line arguments.
4. Read the contents of the files.
5. Use `difflib.unified_diff()` to generate the differences.
6. Print the differences.

Here's the code for the new `diff_files.py` script:

```python
aider/diff_files
^C KeyboardInterrupt
USER: put it in `aider/diffs.py`
2023-06-05 14:33:38 -07:00
Paul Gauthier
7305e9d457 Added new files to the git repo: aider/diffs.py 2023-06-04 09:50:30 -07:00