Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Expose max_buffered_lines as configurable option #427

Closed
huzecong opened this issue Dec 5, 2020 · 3 comments · Fixed by #429
Closed

🚀 Expose max_buffered_lines as configurable option #427

huzecong opened this issue Dec 5, 2020 · 3 comments · Fixed by #429

Comments

@huzecong
Copy link

huzecong commented Dec 5, 2020

Thanks for writing this wonderful piece of software! Here's my feature request:

Would it be possible to expose max_buffered_lines as a configurable option (preferrably as a command line argument)?

Sometimes I need to work with large diffs using side-by-side mode, but when there are too many consecutive lines with diffs, it would get rendered as deleting and inserting whole lines instead of inline edits. Currently max_buffered_lines is hard-coded as 32, I could be wrong, but I don't see any reason that we couldn't set it to a larger number.

dandavison added a commit that referenced this issue Dec 5, 2020
dandavison added a commit that referenced this issue Dec 5, 2020
@dandavison
Copy link
Owner

Hi @huzecong, thanks! I've done that in a branch named 427-line-buffer-size. The new option is called line-buffer-size. Are you able to build delta from source and confirm that this fixes your problem? That would be very helpful! Do you have an example diff that you could post that exhibits the problem?

@huzecong
Copy link
Author

huzecong commented Dec 5, 2020

This is awesome, thanks for the speedy change! Here's an example diff that exhibits the problem; basically, any diff with > 32 consecutive lines of edits would trigger this:

--- minus.txt	2020-12-05 01:39:08.000000000 -0500
+++ plus.txt	2020-12-05 01:39:09.000000000 -0500
@@ -1,33 +1,33 @@
-key_0: value_0
-key_1: value_1
-key_2: value_2
-key_3: value_3
-key_4: value_4
-key_5: value_5
-key_6: value_6
-key_7: value_7
-key_8: value_8
-key_9: value_9
-key_10: value_10
-key_11: value_11
-key_12: value_12
-key_13: value_13
-key_14: value_14
-key_15: value_15
-key_16: value_16
-key_17: value_17
-key_18: value_18
-key_19: value_19
-key_20: value_20
-key_21: value_21
-key_22: value_22
-key_23: value_23
-key_24: value_24
-key_25: value_25
-key_26: value_26
-key_27: value_27
-key_28: value_28
-key_29: value_29
-key_30: value_30
-key_31: value_31
-key_32: value_32
+key_0: value_1
+key_1: value_2
+key_2: value_3
+key_3: value_4
+key_4: value_5
+key_5: value_6
+key_6: value_7
+key_7: value_8
+key_8: value_9
+key_9: value_10
+key_10: value_11
+key_11: value_12
+key_12: value_13
+key_13: value_14
+key_14: value_15
+key_15: value_16
+key_16: value_17
+key_17: value_18
+key_18: value_19
+key_19: value_20
+key_20: value_21
+key_21: value_22
+key_22: value_23
+key_23: value_24
+key_24: value_25
+key_25: value_26
+key_26: value_27
+key_27: value_28
+key_28: value_29
+key_29: value_30
+key_30: value_31
+key_31: value_32
+key_32: value_33

I can confirm that the PR solves the problem. I was able to get normal output with the above diff when run with --line-buffer-size=33.

@dandavison
Copy link
Owner

Great, that's merged to master. Thanks for the diff, a unit test for this shall be made out of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants