Skip to content

Commit

Permalink
Fix navigation between chunks after splitting chunk
Browse files Browse the repository at this point in the history
Also fix the color of the first split chunk.

Closes jonas#1101
  • Loading branch information
koutcher committed Nov 27, 2021
1 parent 15aab28 commit 45e9dfd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 45e9dfd

Please sign in to comment.