Skip to content
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

Passing cols or rows into ctor as undefined will break terminal #3453

Merged
merged 3 commits into from
Sep 3, 2021

Conversation

silamon
Copy link
Contributor

@silamon silamon commented Sep 1, 2021

this.cols = Math.max(_optionsService.options.cols, MINIMUM_COLS);
this.rows = Math.max(_optionsService.options.rows, MINIMUM_ROWS);

Passing undefined to cols or rows would result in NaN. Passing null works as expected.

Fixes #3329

@Tyriar Tyriar added this to the 4.14.0 milestone Sep 1, 2021
@@ -10,13 +10,23 @@ describe('OptionsService', () => {
describe('constructor', () => {
const originalError = console.error;
beforeEach(() => {
console.error = () => {};
console.error = () => { };
Copy link
Member

@meganrogge meganrogge Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should revert this formatting change

it('uses default value if invalid constructor option value passed', () => {
assert.equal(new OptionsService({tabStopWidth: 0}).getOption('tabStopWidth'), DEFAULT_OPTIONS.tabStopWidth);
assert.equal(new OptionsService({ tabStopWidth: 0 }).getOption('tabStopWidth'), DEFAULT_OPTIONS.tabStopWidth);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert.equal(new OptionsService({ tabStopWidth: 0 }).getOption('tabStopWidth'), DEFAULT_OPTIONS.tabStopWidth);
assert.equal(new OptionsService({tabStopWidth: 0}).getOption('tabStopWidth'), DEFAULT_OPTIONS.tabStopWidth);

@@ -22,7 +22,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
cursorStyle: 'block',
cursorWidth: 1,
customGlyphs: true,
bellSound: DEFAULT_BELL_SOUND,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undo

@@ -128,7 +128,7 @@ export class OptionsService implements IOptionsService {
break;
case 'cursorWidth':
value = Math.floor(value);
// Fall through for bounds check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undo

Copy link
Member

@meganrogge meganrogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks - a few formatting changes should be reverted

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Tyriar Tyriar merged commit b5df612 into xtermjs:master Sep 3, 2021
@silamon silamon deleted the undefinedrowscols branch October 16, 2022 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing cols or rows into ctor as undefined will break terminal
3 participants