From 1ca8a052164e5ec32189b6386a7b2091d0254405 Mon Sep 17 00:00:00 2001 From: Thomas Koutcher Date: Tue, 4 Jan 2022 21:43:05 +0100 Subject: [PATCH] Fix navigation between chunks after splitting chunk (#1162) Also fix the color of the first split chunk. Closes #1101 Reviewed-by: Johannes Altmanninger --- src/stage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stage.c b/src/stage.c index 156fb5ece..ec9a97801 100644 --- a/src/stage.c +++ b/src/stage.c @@ -25,6 +25,7 @@ #include "tig/status.h" #include "tig/main.h" #include "tig/stage.h" +#include "tig/search.h" static struct status stage_status; static enum line_type stage_line_type; @@ -320,8 +321,10 @@ stage_insert_chunk(struct view *view, struct chunk_header *header, int i; box = from->data; - for (i = 0; i < box->cells; i++) + for (i = 0; i < box->cells; i++) { box->cell[i].length = 0; + box->cell[i].type = LINE_DIFF_CHUNK; + } if (!append_line_format(view, from, "@@ -%lu,%lu +%lu,%lu @@", header->old.position, header->old.lines, @@ -401,6 +404,7 @@ stage_split_chunk(struct view *view, struct line *chunk_start) if (chunks) { stage_insert_chunk(view, &header, chunk_start, NULL, NULL); redraw_view(view); + reset_search(view); report("Split the chunk in %d", chunks + 1); } else { report("The chunk cannot be split");