u
This commit is contained in:
@@ -17,6 +17,14 @@ test('decodes SGR wheel direction', () => {
|
||||
assert.equal(wheelDeltaFromInput('[<97;88;20M'), 1);
|
||||
});
|
||||
|
||||
test('decodes legacy X10 wheel direction', () => {
|
||||
const x10Up = `\x1b[M${String.fromCharCode(96)}!#`;
|
||||
const x10Down = `\x1b[M${String.fromCharCode(97)}!#`;
|
||||
assert.equal(wheelDeltaFromInput(x10Up), -1);
|
||||
assert.equal(wheelDeltaFromInput(x10Down), 1);
|
||||
assert.equal(wheelDeltaFromInput(x10Up.slice(1)), -1, 'accepts Ink-stripped ESC');
|
||||
});
|
||||
|
||||
test('ignores non-wheel and incomplete mouse input', () => {
|
||||
assert.equal(wheelDeltaFromInput('[<0;1;1M'), 0);
|
||||
assert.equal(wheelDeltaFromInput('[<64;1;1'), 0);
|
||||
@@ -28,4 +36,20 @@ test('removes mouse reports without dropping surrounding text', () => {
|
||||
assert.equal(containsMouseSequence(value), true);
|
||||
assert.equal(stripMouseSequences(value), 'beforeafter');
|
||||
assert.equal(stripMouseSequences('plain text'), 'plain text');
|
||||
|
||||
const x10 = `\x1b[M${String.fromCharCode(96)}!#`;
|
||||
assert.equal(containsMouseSequence(x10), true);
|
||||
assert.equal(stripMouseSequences(`before${x10}after`), 'beforeafter');
|
||||
});
|
||||
|
||||
test('reassembles an SGR wheel report split across input events', () => {
|
||||
assert.equal(wheelDeltaFromInput('[<64;'), 0);
|
||||
assert.equal(wheelDeltaFromInput('88;20M'), -1);
|
||||
// A normal key clears any stale partial sequence state.
|
||||
assert.equal(wheelDeltaFromInput('x'), 0);
|
||||
});
|
||||
|
||||
test('removes split SGR fragments from a text-input value', () => {
|
||||
assert.equal(stripMouseSequences('before[<64;'), 'before');
|
||||
assert.equal(stripMouseSequences('before88;20M'), 'before');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user