v1.1.1: theme-token diff card with old/new line-number gutter; hunks carry oldStart/newStart/rows
This commit is contained in:
1 parent
0dae0ee53d
commit
583aa9a10b
5 files changed
+137
-45
No files matched your search
@@ -194,3 +194,16 @@ test('grep pages at pageLines with an offset cursor', async () => {
|
||||
assert.doesNotMatch(p2.text, /offset=/)
|
||||
h.cleanup()
|
||||
})
|
||||
|
||||
test('edit result diffs carry file line numbers and rows for the gutter', async () => {
|
||||
const { h, agent } = await setup()
|
||||
h.write('long.txt', Array.from({ length: 30 }, (_, i) => `line ${i + 1}`).join('\n') + '\n')
|
||||
const tag = /#([0-9A-F]{4})\]/.exec((await h.call(agent, 'read', { file_path: 'long.txt' })).text)[1]
|
||||
const e = await h.call(agent, 'edit', { input: `[long.txt#${tag}]\nPUT 20.=20:\n+LINE TWENTY\n+extra` })
|
||||
const [d] = e.meta.diffs
|
||||
assert.equal(d.oldStart, 17)
|
||||
assert.equal(d.newStart, 17)
|
||||
assert.deepEqual(d.rows.slice(2, 6), [['=', 'line 19'], ['-', 'line 20'], ['+', 'LINE TWENTY'], ['+', 'extra']])
|
||||
assert.equal(typeof d.oldText, 'string') // stock DiffHunk fields stay intact
|
||||
h.cleanup()
|
||||
})
|
||||
Reference in new issue
Block a user