fix(addon-search): continue whole-word search within same line

Scan for additional matches when the first candidate fails whole-word
checks instead of returning early.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-05-25 17:38:35 -07:00
co-authored by Cursor
parent 0b1cacd1a5
commit 11720c9dc3
2 changed files with 73 additions and 8 deletions
@@ -146,6 +146,17 @@ describe('SearchEngine', () => {
assert.strictEqual(searchEngine.find('world', 0, 0, { wholeWord: true }), undefined);
});
it('should find later whole word after partial match on same line', async () => {
await writeP(terminal, 'foobar foo');
assert.deepStrictEqual(searchEngine.find('foo', 0, 0, { wholeWord: true }), {
term: 'foo',
col: 7,
row: 0,
size: 3
});
});
it('should find word at beginning of line with wholeWord', async () => {
await writeP(terminal, 'world is great');