Change:
return false; } }); <del> (<HTMLElement>this._xterm.element).addEventListener('mouseup', event => { </del> <ins> this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'mouseup', (event: KeyboardEvent) => { </ins> // Wait until mouseup has propogated through the DOM before evaluating the new selection // state. setTimeout(() => { this._refreshSelectionContextKey(); }, 0); <del> }); </del> <ins> })); </ins> // xterm.js currently drops selection on keyup as we need to handle this case. <del> (<HTMLElement>this._xterm.element).addEventListener('keyup', event => { </del> <ins> this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'keyup', (event: KeyboardEvent) => { </ins> // Wait until keyup has propogated through the DOM before evaluating the new selection // state. setTimeout(() => { this._refreshSelectionContextKey(); }, 0); <del> }); </del> <ins> })); </ins> const xtermHelper: HTMLElement = this._xterm.element.querySelector('.xterm-helpers'); const focusTrap: HTMLElement = document.createElement('div'); focusTrap.setAttribute('tabindex', '0'); DOM.addClass(focusTrap, 'focus-trap'); <del> focusTrap.addEventListener('focus', function (event: FocusEvent) { </del> <ins> this._instanceDisposables.push(DOM.addDisposableListener(focusTrap, 'focus', (event: FocusEvent) => { </ins> let currentElement = focusTrap; while (!DOM.hasClass(currentElement, 'part')) { currentElement = currentElement.parentElement; } const hidePanelElement = <HTMLElement>currentElement.querySelector('.hide-panel-action'); hidePanelElement.focus(); <del> }); </del> <ins> })); </ins> xtermHelper.insertBefore(focusTrap, this._xterm.textarea); <del> this._toDispose.push(DOM.addDisposableListener(this._xterm.textarea, 'focus', (event: KeyboardEvent) => { </del> <ins> this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.textarea, 'focus', (event: KeyboardEvent) => { </ins> this._terminalFocusContextKey.set(true); })); <del> this._toDispose.push(DOM.addDisposableListener(this._xterm.textarea, 'blur', (event: KeyboardEvent) => { </del> <ins> this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.textarea, 'blur', (event: KeyboardEvent) => { </ins> this._terminalFocusContextKey.reset(); this._refreshSelectionContextKey(); })); <del> this._toDispose.push(DOM.addDisposableListener(this._xterm.element, 'focus', (event: KeyboardEvent) => { </del> <ins> this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'focus', (event: KeyboardEvent) => { </ins> this._terminalFocusContextKey.set(true); })); <del> this._toDispose.push(DOM.addDisposableListener(this._xterm.element, 'blur', (event: KeyboardEvent) => { </del> <ins> this._instanceDisposables.push(DOM.addDisposableListener(this._xterm.element, 'blur', (event: KeyboardEvent) => { </ins> this._terminalFocusContextKey.reset(); this._refreshSelectionContextKey(); }));

Discussion:
From
For January we decided to keep the task in the core. So there is no need to make this 'public' API now. May be it would be good to first experiment a little with the new API.
just to make sure, were you thinking of using a prompt (press any key to close) that can be reused? Or a terminal that executes something, the pty process dies and just sits there ("dead") until another task command is sent?
I would like to achieve the following: create a new terminal and allow terminal reuse (could be an additional option) without actually running a terminal right away (if necessary we could run it as well) run a command in the terminal. This will create the actual shell process. Usually the shell would be started with /c receive an exit event when the shell exists reuse the terminal to run another command in the terminal which creates a new shell process. Use case if for a build task: if the user runs the build tasks 3 times in a row I would like to have one terminal (e.g. on entry in the drop down in the terminal pane) which contains the output of all three task runs.
I have one additional question. Does the terminal require to run a shell or would the terminal be able to run any other arbitrary process (for example a ).
I got it working to run an arbitrary program. Only drawback is that I needed to specify the full path to the program (e.g. ). Any idea why this is the case?
do you mean the shell path you're using is and it's not working like that? I guess the resolution stuff is contained within , I would think it would probably be safest to always wrap the command within or . Wrapping the command means the process will die when it finishes so I don't see a downside?
the only problem is argument passing with spaces contained. If you call node directly then you pass the args as a string[]. If you call the for example you need to construct a single string with proper arg quoting to ensure everything works when for example the command to call contains spaces. And you save a process :-)
could this be useful for Python terminal execution?