-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Implement dynamic context lines (zooming) #1120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't make it work on my machine as I assumed it would (going to "regular diff" and hitting +/-) .. it seems to keep the hunks in place while simply changing the hunk line numbers/counts...
I'm not sure I'm doing it right, could you add some description to the implementation please?
c9c046c
to
02a6d78
Compare
Maybe that's what the feature does. It just increases or decreases the contextual lines. E.g. if you press '-' you get more but shorter hunks. But more often you use '+' to see more code. |
(GitHub has way more aggressive expanding, they expand by 20 lines if you click in their diff views.) |
@@ -18,6 +19,17 @@ | |||
from ...common import util | |||
|
|||
|
|||
if False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's for 'mypy' typing. mypy will read and import the stuff in the 'False' branch but Sublime's python will not execute this code.
Another way to write this is
MYPY = False
if MYPY:
...from typing ...
which is probably just as confusing. @asfaltboy already asked the same question. 😁 but we first have to decide if these type annotations are welcome here at all.
Can you rebase on dev and clean the chage default commit into original. |
b5553e1
to
12dbad0
Compare
Fixes timbrel#1065 Add `[+]`/`[-]` shortcuts to increase or decrease the contextual lines `git diff` will output. Uses the already implemented fuzzy hunk search to place the cursor correctly after refreshing the view. Note: We set `"--unidiff-zero"` when hunking if we do not show any contextual lines which is otherwise discouraged bc it is mildly unsafe. Added type annotations and some comments to old functions.
Done. |
@@ -432,6 +432,46 @@ def setUp(self): | |||
def tearDown(self): | |||
unstub() | |||
|
|||
@p.expand([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not to fimiliar with writing these teste what does this do?
Nothing problamatic just think it would be good to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p.expand
= paramterize the tests
expand
takes a list of tuples/args, and will create a separate test for each args/invocation signature.
Fixes #1065
Add
[+]
/[-]
shortcuts to increase or decrease the contextual linesgit diff
will output.Uses the already implemented fuzzy hunk search to place the cursor correctly
after refreshing the view.
Note: We set
"--unidiff-zero"
when hunking if we do not show any contextuallines which is otherwise discouraged bc it is mildly unsafe.
Added type annotations and some comments to old functions.