summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Koutcher <thomas.koutcher@online.fr>2024-01-24 23:31:47 +0100
committerThomas Koutcher <thomas.koutcher@online.fr>2024-01-25 22:39:53 +0100
commit0a7f65f4f5a77622a1bf980d1f692479cd8f4a83 (patch)
treecc6dffcb8b64c3480af28e9270c7e17ae6061ab9
parente2f1af494229832fb834fac46b4bfb3ba3f3bacd (diff)
Fix chunk staging behaviour in plain stage view
* Reflect changes in the Untracked / Unstaged / Staged changes lines when returning to the main view after partial staging / unstaging. * Close the view after staging the last chunk.
-rw-r--r--src/stage.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/stage.c b/src/stage.c
index 05695c79..046dfef5 100644
--- a/src/stage.c
+++ b/src/stage.c
@@ -283,6 +283,10 @@ stage_update(struct view *view, struct line *line, update_t update_type)
return false;
}
+ watch_apply(&view->watch, stage_line_type == LINE_STAT_STAGED
+ ? WATCH_INDEX_UNSTAGED_YES | WATCH_INDEX_UNTRACKED_YES
+ : WATCH_INDEX_STAGED_YES);
+
return true;
}
@@ -795,7 +799,8 @@ stage_read(struct view *view, struct buffer *buf, bool force_stop)
return false;
}
- if (!view->lines && !force_stop && view->prev) {
+ /* After git apply, git diff-files can sometimes return an empty line. */
+ if (view->lines <= 1 && !force_stop && view->prev) {
watch_apply(&view->watch, WATCH_INDEX);
stage_line_type = 0;
maximize_view(view->prev, false);