File tree Expand file tree Collapse file tree 5 files changed +12
-4
lines changed
Expand file tree Collapse file tree 5 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -995,7 +995,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
995995 const shouldIgnoreComposition = this . browser . isMac && this . options . macOptionIsMeta && event . altKey ;
996996
997997 if ( ! shouldIgnoreComposition && ! this . _compositionHelper ! . keydown ( event ) ) {
998- if ( this . buffer . ybase !== this . buffer . ydisp ) {
998+ if ( this . options . scrollOnUserInput && this . buffer . ybase !== this . buffer . ydisp ) {
999999 this . _bufferService . scrollToBottom ( ) ;
10001000 }
10011001 return false ;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export class CoreService extends Disposable implements ICoreService {
6868
6969 // Input is being sent to the terminal, the terminal should focus the prompt.
7070 const buffer = this . _bufferService . buffer ;
71- if ( buffer . ybase !== buffer . ydisp ) {
71+ if ( wasUserInput && this . _optionsService . rawOptions . scrollOnUserInput && buffer . ybase !== buffer . ydisp ) {
7272 this . _scrollToBottom ! ( ) ;
7373 }
7474
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
2828 linkHandler : null ,
2929 logLevel : 'info' ,
3030 scrollback : 1000 ,
31+ scrollOnUserInput : true ,
3132 scrollSensitivity : 1 ,
3233 screenReaderMode : false ,
3334 smoothScrollDuration : 0 ,
Original file line number Diff line number Diff line change @@ -85,9 +85,9 @@ export interface ICoreService {
8585 /**
8686 * Triggers the onData event in the public API.
8787 * @param data The data that is being emitted.
88- * @param wasFromUser Whether the data originated from the user (as opposed to
88+ * @param wasUserInput Whether the data originated from the user (as opposed to
8989 * resulting from parsing incoming data). When true this will also:
90- * - Scroll to the bottom of the buffer.s
90+ * - Scroll to the bottom of the buffer if option scrollOnUserInput is true.
9191 * - Fire the `onUserInput` event (so selection can be cleared).
9292 */
9393 triggerDataEvent ( data : string , wasUserInput ?: boolean ) : void ;
@@ -243,6 +243,7 @@ export interface ITerminalOptions {
243243 rows ?: number ;
244244 screenReaderMode ?: boolean ;
245245 scrollback ?: number ;
246+ scrollOnUserInput ?: boolean ;
246247 scrollSensitivity ?: number ;
247248 smoothScrollDuration ?: number ;
248249 tabStopWidth ?: number ;
Original file line number Diff line number Diff line change @@ -193,6 +193,12 @@ declare module 'xterm' {
193193 */
194194 scrollback ?: number ;
195195
196+ /**
197+ * Whether to scroll to the bottom whenever there is some user input. The
198+ * default is true.
199+ */
200+ scrollOnUserInput ?: boolean ;
201+
196202 /**
197203 * The scrolling speed multiplier used for adjusting normal scrolling speed.
198204 */
You can’t perform that action at this time.
0 commit comments