Skip to content

Commit ac1ce9b

Browse files
committed
refactor: block navigation after staging/unstaging/discarding a block(chunk) (#2659)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 0e83ccd commit ac1ce9b

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/ViewModels/BlockNavigation.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,27 @@ public void UpdateByChunk(TextDiffSelectedChunk chunk)
123123
if (chunkStart > block.End)
124124
continue;
125125

126-
if (chunkEnd < block.Start)
126+
var hasChangeAfter = false;
127+
for (var j = i; j < _blocks.Count; j++)
127128
{
128-
_current = i - 1;
129-
break;
129+
var test = _blocks[j];
130+
if (chunkEnd < test.End)
131+
{
132+
_current = i;
133+
hasChangeAfter = true;
134+
break;
135+
}
130136
}
131137

132-
_current = i;
138+
if (!hasChangeAfter)
139+
{
140+
if (chunkStart > block.Start)
141+
_current = i;
142+
else
143+
_current = i - 1;
144+
}
145+
146+
break;
133147
}
134148
}
135149

0 commit comments

Comments
 (0)