Skip to content

Commit

Permalink
Main view: fix diff view display for staged/unstaged changes
Browse files Browse the repository at this point in the history
Shows actual diff of stage/unstaged state instead of just a blank diff
with "[diff] 0000000000000000000000000000000000000000" in the status
bar.

[ Set flags depending on whether the diff view is requested ]

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
  • Loading branch information
lian authored and jonas committed Feb 18, 2013
1 parent a49bafa commit f996cef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tig.c
Expand Up @@ -7359,7 +7359,8 @@ main_read(struct view *view, char *line)
static enum request
main_request(struct view *view, enum request request, struct line *line)
{
enum open_flags flags = view_is_displayed(view) ? OPEN_SPLIT : OPEN_DEFAULT;
enum open_flags flags = (view_is_displayed(view) && request != REQ_VIEW_DIFF)
? OPEN_SPLIT : OPEN_DEFAULT;

switch (request) {
case REQ_NEXT:
Expand All @@ -7371,6 +7372,7 @@ main_request(struct view *view, enum request request, struct line *line)
move_view(view, request);
break;

case REQ_VIEW_DIFF:
case REQ_ENTER:
if (view_is_displayed(view) && display[0] != view)
maximize_view(view, TRUE);
Expand All @@ -7397,6 +7399,7 @@ main_request(struct view *view, enum request request, struct line *line)

open_view(view, REQ_VIEW_DIFF, flags);
break;

case REQ_REFRESH:
load_refs();
refresh_view(view);
Expand Down

0 comments on commit f996cef

Please sign in to comment.