-
Notifications
You must be signed in to change notification settings - Fork 626
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
Untracked only status view #909
Conversation
src/status.c
Outdated
@@ -738,6 +746,8 @@ status_request(struct view *view, enum request request, struct line *line) | |||
return request; | |||
} | |||
|
|||
if (view->parent) |
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.
@jonas, is it the proper way to trig a refresh of the parent view ?
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.
Trigger a reload of the main view? Some views like stage has explicit logic based on the parent view if I recall correctly.
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 noticed it and I also noticed there is no direct call to update_view, but I could not spot which part is the trigger for this logic.
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 found it ! update_view is actually called for parent in main_status_exists itself called by stage_exists at the end of stage_request. So my code should be correct.
src/status.c
Outdated
open_status_view(struct view *prev, bool untracked_only, enum open_flags flags) | ||
{ | ||
show_untracked_only=untracked_only; | ||
open_view(prev, &status_view, flags | OPEN_REFRESH); |
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.
Is the OPEN_REFRESH
serving a purpose? It was not there in the inline version.
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.
Yes, without it, if you open the status view from the Untracked changes line and then want to open it after with the s key to have the full content, then the content remains the Untracked only.
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.
It looks like it causes an assertion failure.
src/status.c
Outdated
@@ -738,6 +746,8 @@ status_request(struct view *view, enum request request, struct line *line) | |||
return request; | |||
} | |||
|
|||
if (view->parent) |
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.
Trigger a reload of the main view? Some views like stage has explicit logic based on the parent view if I recall correctly.
b07d66f
to
df70884
Compare
OK, I see the assert(flags ^ OPEN_REFRESH)... I have to try with OPEN_RELOAD instead.
|
f0e349e
to
bc7f6d4
Compare
I've tested the PR, the behavior is totally reasonable, fits well with the rest of tig. |
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.
Looking forward to trying it!
|
||
|
||
|
||
[status] Nothing to update 100% |
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.
Sweet
@@ -738,6 +754,9 @@ status_request(struct view *view, enum request request, struct line *line) | |||
return request; | |||
} | |||
|
|||
if (show_untracked_only && view->parent && !main_status_exists(view->parent, LINE_STAT_UNTRACKED)) | |||
return REQ_VIEW_CLOSE; |
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.
Even if the status can only ever have the main view as the parent it would still be good to have a view->parent == &main_view
before calling main_status_exists
.
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.
Wilco
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 like "Impossible Germany" :-)
https://www.youtube.com/watch?v=r_0BPqWpM_M
…m Untracked changes line" This reverts commit 4f9b35e.
bc7f6d4
to
2b7bc4f
Compare
I changed the view->parent test to view->parent == &main_view, rebased on master and squashed a bit. |
2b7bc4f
to
247f371
Compare
I'll let you merge. |
Following discussions with @proski in #762, I decided to give a try to a "Untracked only" status view when called from the Untracked changes line. Having in mind the use case of checking quickly which files were left behind, this version seems indeed better than opening the regular status view and moving the cursor to the Untracked files currently implemented.
@jonas, the refresh part surely needs to be reviewed.