-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1993 from Tyriar/windows_mode
Replace winptyCompat addon with windowsMode option
- Loading branch information
Showing
11 changed files
with
73 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
import { IDisposable } from 'xterm'; | ||
import { ITerminal } from './Types'; | ||
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './Buffer'; | ||
|
||
export function applyWindowsMode(terminal: ITerminal): IDisposable { | ||
// Winpty does not support wraparound mode which means that lines will never | ||
// be marked as wrapped. This causes issues for things like copying a line | ||
// retaining the wrapped new line characters or if consumers are listening | ||
// in on the data stream. | ||
// | ||
// The workaround for this is to listen to every incoming line feed and mark | ||
// the line as wrapped if the last character in the previous line is not a | ||
// space. This is certainly not without its problems, but generally on | ||
// Windows when text reaches the end of the terminal it's likely going to be | ||
// wrapped. | ||
return terminal.addDisposableListener('linefeed', () => { | ||
const line = terminal.buffer.lines.get(terminal.buffer.ybase + terminal.buffer.y - 1); | ||
const lastChar = line.get(terminal.cols - 1); | ||
|
||
if (lastChar[CHAR_DATA_CODE_INDEX] !== NULL_CELL_CODE && lastChar[CHAR_DATA_CODE_INDEX] !== WHITESPACE_CELL_CODE) { | ||
const nextLine = terminal.buffer.lines.get(terminal.buffer.ybase + terminal.buffer.y); | ||
nextLine.isWrapped = true; | ||
} | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters