pinokiod 8.3.12 → 8.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
(function (global) {
|
|
2
|
+
// xterm sends scrolling as SGR mouse reports or repeated Up/Down keys.
|
|
3
|
+
// Ignore whole chunks of those reports when building the tab preview.
|
|
4
|
+
const scrollInput = /^(?:\x1b\[<\d+;\d+;\d+[Mm]|\x1b(?:\[|O)[AB])+$/
|
|
5
|
+
|
|
2
6
|
function processTerminalInputData(data, handlers) {
|
|
3
|
-
if (!data || typeof data !== 'string' || !handlers) {
|
|
7
|
+
if (!data || typeof data !== 'string' || !handlers || scrollInput.test(data)) {
|
|
4
8
|
return
|
|
5
9
|
}
|
|
6
10
|
const capture = typeof handlers.capture === 'function' ? handlers.capture : function () {}
|
|
@@ -172,6 +172,21 @@ test('a finger drag scrolls a program that tracks the mouse on the normal screen
|
|
|
172
172
|
assert.deepEqual(wheel, [1, 1])
|
|
173
173
|
})
|
|
174
174
|
|
|
175
|
+
test('scrolling before a paste keeps mouse reports and arrow keys out of the tab preview', (t) => {
|
|
176
|
+
const { window } = page(t)
|
|
177
|
+
for (const script of ['terminal_input_utils.js', 'terminal_input_tracker.js']) {
|
|
178
|
+
window.eval(fs.readFileSync(path.resolve(__dirname, '../server/public', script), 'utf8'))
|
|
179
|
+
}
|
|
180
|
+
const tracker = new window.TerminalInputTracker()
|
|
181
|
+
const previews = []
|
|
182
|
+
tracker.submit = (line) => previews.push(line)
|
|
183
|
+
const handlers = { capture: (text) => tracker.capture(text) }
|
|
184
|
+
for (const chunk of ['echo ', '\x1b[<64;12;5M', '\x1b[<0;12;5m', '\x1b[A\x1b[B', '\x1bOA\x1bOB', '[A\r']) {
|
|
185
|
+
window.processTerminalInputData(chunk, handlers)
|
|
186
|
+
}
|
|
187
|
+
assert.deepEqual(previews, ['echo [A'])
|
|
188
|
+
})
|
|
189
|
+
|
|
175
190
|
test('at a shell prompt a finger drag is left to the terminal and sends nothing', (t) => {
|
|
176
191
|
const { wheel, touch, attach, screenSize } = page(t)
|
|
177
192
|
attach()
|