microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.18k stars 29.29k forks source link

Integrated terminal slices off first character of every output #121651

Closed gruelingpine185 closed 3 years ago

gruelingpine185 commented 3 years ago

Steps to Reproduce: I'm not too sure how to reproduce it, but this is the code I ran:

colors.js

const colors = {};

colors.pre = '\u001b[';
colors.reset = `${colors.pre}0`;

colors.fg = ['30','31','32','33','34','35','36','37'];
colors.bg = ['40','41','42','43','44','45','46','47'];
colors.bright = [''];
colors.colors = ['black','red','green','yellow','blue','magenta','cyan','white'];

colors.bind = (settings, ...text) => {

    const fg = ((settings[0] === 8) && (settings[1] !== 'undefined'))?
        settings[1]: console.log('hello');
    return `${colors.pre+fg}m${text}${colors.reset}`;
}

module.exports = {
    colors
}

colors.test.js

const {colors} = require('../src/colors');

function testColors(color, ...text) {
    console.log(colors.bind(color, text));
}

testColors([8], 'Color test', ' 2nd arg');
# output:
ndefinedmColor test, 2nd argb/projects/endeavor/upkeep/test/colors.test.js'

# testColors([8, null], 'Color test', ' 2nd arg'); produces:
ullmColor test, 2nd arg

The input is fine

upkeep $ node '/Users/adrianb/projects/endeavor/upkeep/test/colors.test.js'

Does this issue occur when all extensions are disabled?: Yes

gruelingpine185 commented 3 years ago

It must have loaded incorrectly. I restarted VsCode and now the problem is gone, but If it continues later on I'll let you guys know.

gruelingpine185 commented 3 years ago

This is another bug I get occasionally. I don't believe it is reproducible either, but here is a short video of what I see.

If for whatever reason the video doesn't play, it's showing the following:

https://user-images.githubusercontent.com/66073333/115584071-7b29d580-a298-11eb-8d2f-ceac42baa132.mov

meganrogge commented 3 years ago

Thanks for this info. Please open an issue if you have reproducible steps and i'll investigate