Skip to content

Commit

Permalink
fix: activate pane item on focus (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed May 3, 2021
1 parent b40d333 commit dcb0fc5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion spec/model-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('XTerminalModel', () => {
spyOn(XTerminalProfilesSingleton.instance, 'generateNewUri').and.returnValue(uri)
model = await createNewModel()
pane = jasmine.createSpyObj('pane',
['destroyItem', 'getActiveItem'])
['destroyItem', 'getActiveItem', 'activateItem'])
element = jasmine.createSpyObj('element',
['destroy', 'refitTerminal', 'focusOnTerminal', 'clickOnCurrentAnchor', 'getCurrentAnchorHref', 'restartPtyProcess', 'clear'])
element.terminal = jasmine.createSpyObj('terminal',
Expand Down Expand Up @@ -373,6 +373,13 @@ describe('XTerminalModel', () => {
expect(model.emitter.emit).toHaveBeenCalled()
})

it('focusOnTerminal() activate pane', () => {
model.element = element
model.pane = pane
model.focusOnTerminal()
expect(model.pane.activateItem).toHaveBeenCalled()
})

it('exit()', () => {
model.pane = pane
model.exit()
Expand Down
3 changes: 3 additions & 0 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ class XTerminalModel {
}

focusOnTerminal (double) {
if (this.pane) {
this.pane.activateItem(this)
}
this.element.focusOnTerminal(double)
if (this.modified) {
this.modified = false
Expand Down

0 comments on commit dcb0fc5

Please sign in to comment.