mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-11 01:28:19 +03:00
Fix position output in matcher
This commit is contained in:
parent
064fc17ce3
commit
ca1b2454bd
@ -66,10 +66,10 @@ static void
|
||||
output_positions(GlobalData *global, len_t *positions, len_t num) {
|
||||
wchar_t buf[128];
|
||||
for (len_t i = 0; i < num; i++) {
|
||||
int num = swprintf(buf, sizeof(buf)/sizeof(buf[0]), L"%u", positions[i]);
|
||||
if (num > 0 && ensure_space(global, num + 1)) {
|
||||
for (int i = 0; i < num; i++) global->output[global->output_pos++] = buf[i];
|
||||
global->output[global->output_pos++] = (i == num - 1) ? ',' : ':';
|
||||
int pnum = swprintf(buf, arraysz(buf), L"%u", positions[i]);
|
||||
if (pnum > 0 && ensure_space(global, pnum + 1)) {
|
||||
for (int k = 0; k < pnum; k++) global->output[global->output_pos++] = buf[k];
|
||||
global->output[global->output_pos++] = (i == num - 1) ? ':' : ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ class TestMatcher(BaseTest):
|
||||
def test_positions(self):
|
||||
' Output of positions '
|
||||
self.basic_test('abc\nac', 'ac', '0,1:ac\n0,2:abc', positions=True)
|
||||
self.basic_test('abc\nv', 'a', '0:abc', positions=True)
|
||||
|
||||
def test_delimiter(self):
|
||||
' Test using a custom line delimiter '
|
||||
|
Loading…
Reference in New Issue
Block a user