Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 77dfb54

Browse files
myan9starpit
authored andcommitted
fix(plugins/plugin-client-common): when there're 3 splits, clicking table cells in the first split fail
Fixes #6937
1 parent 027b279 commit 77dfb54

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

plugins/plugin-client-common/src/components/Views/Terminal/ScrollableTerminal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ export default class ScrollableTerminal extends React.PureComponent<Props, State
914914
: !(await thisSplit.facade.REPL.qexec<boolean>(request.spec.options.ifnot).catch(() => true))
915915
if (!respIf || !respIfNot) {
916916
const { cmdline } = request.spec.options
917-
const mainSplit = this.findMainSplit(thisSplitIdx)
917+
const mainSplit = this.findMainSplit(thisSplitIdx) || thisSplit
918918
request.spec.options.cmdline = undefined // null this out, since we got it!
919919
mainSplit.facade.REPL.pexec(cmdline)
920920
return

plugins/plugin-core-support/src/test/core-support2/split-terminals.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,65 @@ describe('split close and reopen', function(this: Common.ISuite) {
325325
}
326326
})
327327
})
328+
329+
describe('click and show in splits', function(this: Common.ISuite) {
330+
before(Common.before(this))
331+
after(Common.after(this))
332+
Util.closeAllExceptFirstTab.bind(this)()
333+
334+
const splitTheTerminalViaButton = splitViaButton.bind(this)
335+
const count = expectSplits.bind(this)
336+
337+
let selector: string
338+
339+
const doClickAndValidate = (splitIndex: number) => {
340+
return this.app.client.waitUntil(async () => {
341+
await this.app.client.$(selector).then(_ => _.click())
342+
343+
const text = await this.app.client.$(`${Selectors.OUTPUT_LAST_FOR_SPLIT(splitIndex)}`).then(_ => _.getText())
344+
345+
return text === 'hi'
346+
})
347+
}
348+
349+
const clickAndValidate = splitIndex => {
350+
it(`should click in the first split and show in split: ${splitIndex}`, async () => {
351+
try {
352+
await doClickAndValidate(splitIndex)
353+
} catch (err) {
354+
await Common.oops(this, true)(err)
355+
}
356+
})
357+
}
358+
359+
it('should click in the first split and show in the second split', async () => {
360+
try {
361+
await CLI.command('echo hi', this.app).then(ReplExpect.okWithPtyOutput('hi'))
362+
363+
selector = `${await Util.doList(this, 'history 1', 'echo hi')} [data-value="echo hi"].clickable`
364+
await doClickAndValidate(2)
365+
} catch (err) {
366+
await Common.oops(this, true)(err)
367+
}
368+
})
369+
370+
splitTheTerminalViaButton(3)
371+
count(3)
372+
clickAndValidate(3)
373+
374+
splitTheTerminalViaButton(4)
375+
count(4)
376+
clickAndValidate(4)
377+
378+
splitTheTerminalViaButton(5)
379+
count(5)
380+
clickAndValidate(5)
381+
382+
splitTheTerminalViaButton(6)
383+
count(6)
384+
clickAndValidate(6)
385+
386+
splitTheTerminalViaButton(7)
387+
count(7)
388+
clickAndValidate(7)
389+
})

0 commit comments

Comments
 (0)