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

🚀 Clear the screen before each hunk when using --patch #1875

Open
JacobHayes opened this issue Oct 11, 2024 · 1 comment
Open

🚀 Clear the screen before each hunk when using --patch #1875

JacobHayes opened this issue Oct 11, 2024 · 1 comment

Comments

@JacobHayes
Copy link

JacobHayes commented Oct 11, 2024

When using git {add,reset,...} -p, I'd like the screen to be cleared for each hunk. When adding changes that mix a lot of single line edits that sometimes present as a single hunk and other times are grouped together, it's easy to accidentally review only the final part of a hunk. For example, this diff:

@@ -267,7 +259,7 @@ class MyClass:

 @final
-class MyClass2(Gen[Old]):
+class MyClass2(Gen[New]):

(3/13) Apply this hunk to index [y,n,q,a,d,K,j,J,g,/,e,p,?]? y
@@ -276,7 +268,7 @@ class MyClass2(New):

-    def a(self, deps: Old):
+    def a(self, deps: New):
         return 42

(4/13) Apply this hunk to index [y,n,q,a,d,K,j,J,g,/,e,p,?]? y
@@ -287,23 +279,23 @@ class MyClass2(New):

-    def b(self, deps: Old):
+    def b(self, deps: New
         return 42

-    def c(self, deps: Old):
+    def c(self, deps: New):
         return 42

-    def d(self, deps: Old)
+    def d(self, deps: New)
         return 42

-    def e(self, deps: Old):
+    def e(self, deps: New):
         return 42
(5/13) Apply this hunk to index [y,n,q,a,d,K,j,J,g,/,s,e,p,?]? n

will print one after the other so the prompt is always at the bottom of the screen and the bottom part of each hunk looks about the same when churning through a lot of these. However, note that the last hunk groups multiple edits and has a bug where the b method is missing the trailing ): - but that's easy to miss when your eyes are trained to focus on the bottom of the page (just above the prompt).

Instead, I'd like the page to be cleared before showing each hunk so that each hunk effectively starts from the top of the console. This way, there will be a much better visual cue that a hunk is larger/smaller than the last (which might prompt you to split it).

@bash
Copy link
Contributor

bash commented Oct 11, 2024

Maybe setting interactive.diffFilter to something like clear; delta --color-only --features=interactive already does the trick (I'm not on my computer atm so can't test this myself).

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

No branches or pull requests

2 participants