-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #948 #1108
Fix #948 #1108
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ export const CHAR_DATA_ATTR_INDEX = 0; | |
export const CHAR_DATA_CHAR_INDEX = 1; | ||
export const CHAR_DATA_WIDTH_INDEX = 2; | ||
export const CHAR_DATA_CODE_INDEX = 3; | ||
export const MAX_BUFFER_SIZE = -1 >>> 0; // 2^32 - 1 | ||
|
||
/** | ||
* This class represents a terminal buffer (an internal state of the terminal), where the | ||
|
@@ -68,7 +69,10 @@ export class Buffer implements IBuffer { | |
if (!this._hasScrollback) { | ||
return rows; | ||
} | ||
return rows + this._terminal.options.scrollback; | ||
|
||
const correctBuferLength = rows + this._terminal.options.scrollback; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Also, is this here only to cover the case where scrollback is set from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When i first bumped into this was via terminal.setOption(), and if my understanding is correct we could also trigger this by resizing the terminal, and increasing the number of rows if the buffer size was MAX_BUFFER_SIZE. |
||
|
||
return correctBuferLength > MAX_BUFFER_SIZE ? MAX_BUFFER_SIZE : correctBuferLength; | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
*/ | ||
|
||
import { BufferSet } from './BufferSet'; | ||
import { Buffer } from './Buffer'; | ||
import { Buffer, MAX_BUFFER_SIZE } from './Buffer'; | ||
import { CompositionHelper } from './CompositionHelper'; | ||
import { EventEmitter } from './EventEmitter'; | ||
import { Viewport } from './Viewport'; | ||
|
@@ -384,6 +384,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT | |
} | ||
break; | ||
case 'scrollback': | ||
value = value > 0 && value <= MAX_BUFFER_SIZE ? value : MAX_BUFFER_SIZE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
if (value < 0) { | ||
console.warn(`${key} cannot be less than 0, value: ${value}`); | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this works consistently across all browsers? Doing an unsigned bit operation on a signed number seems dangerous. Might be better to just stick the number in there.