Change:
Issue Type: <bBug</bOpen a new blank file and paste this: Then start typing after "starthere", in the same line. On my system, the cursor runs ahead of the text being typed. See the gif: ! Tried it on fresh install of the latest insider's edition, without extensions. VS Code version: Code - Insiders 1.38.0-insider (, 2019-08-19T12:53:09.586Z) OS version: Linux x64 4.9.0-9-amd64, XFCE on Debian 9.9 <details<summarySystem Info</summary </detailsExtensions: none <!-- generated by issue reporter --
Are you using any form of zoom? Or a high DPI monitor? Is the cursor drawn correctly when setting ?
related -
I am not using zoom, I was able to repro it on stock insiders edition, without any additional settings. It's a 2K monitor. I can't repro the issue on my home HD monitor, so that might be it. I will post more info tomorrow, when I get back to work, where the monitor is.
I just remembered I was supposed to post more info here :). seems to solve the issue, but VSCode freezes after about a minute of playing around with this setting, and has to be killed by the system. My feeling is that some miscalculation happens after typing for awhile. With , the editor freezes. Without, the incorrect character measurement is introduced, which exhibits like shown above. My display settings are on the screenshot. ! The bug is reproducible on either monitor.
Some more experimenting. It seems it doesn't matter which character I type.Everything seems fine at first, I can type multiple lines of characters without issues. But then I click around a bit, play with selection and then it happens. Afterwards, I can type anywhere, and characters will be incorrectly measured.If I open a new tab, and start typing, everything is fine in that tab (so the incorrect measurement is tied to a tab)I said above that causes editor to freeze. But now I managed to make it freeze without this setting at all, just by holding a single character for a while. Not sure if this is a separate issue or related (EDIT: I suspect freezing is related to the measurement issue).
I've installed version 1.28.2, which is the one my colleague uses successfully on a similar system. Both the freezing and misaligned cursor disappeared. So the problem was introduced within the last 1 year.
This bug has been fixed in to the latest release of ! you can help us out by confirming things are working as expected in the latest Insiders release. If things look good, please leave a comment with the text to let us know. If not, please ensure you're on version of Insiders (today's or later - you can use in the command pallete to check), and leave a comment letting us know what isn't working as expected. Happy Coding!
Given we're not likely to get a response within the next few hours, do you know any way to verify?
I'll be able to try it out tomorrow.
I haven't been able to reproduce this myself, so the change was optimistic to begin with. Since nothing is broken, adding .
I just VNC-d to work computer and tested it. I was able to repro the bug again on the old stable version, and couldn't repro it on the latest insiders. So it seems to be fixed! :+1:

Discussion:
return true; })(); <ins> let monospaceAssumptionsAreValid = true; </ins> const alwaysRenderInlineSelection = (browser.isEdge); export class DomReadingContext {

sb.appendASCIIString('</div>'); let renderedViewLine: IRenderedViewLine | null = null; <del> if (canUseFastRenderedViewLine && lineData.isBasicASCII && options.useMonospaceOptimizations && output.containsForeignElements === ForeignElementType.None) { </del> <ins> if (monospaceAssumptionsAreValid && canUseFastRenderedViewLine && lineData.isBasicASCII && options.useMonospaceOptimizations && output.containsForeignElements === ForeignElementType.None) { </ins> if (lineData.content.length < 300 && renderLineInput.lineTokens.getCount() < 100) { // Browser rounding errors have been observed in Chrome and IE, so using the fast // view line only for short lines. Please test before removing the length check...

return this._renderedViewLine.getWidthIsFast(); } <ins> public needsMonospaceFontCheck(): boolean { if (!this._renderedViewLine) { return false; } return (this._renderedViewLine instanceof FastRenderedViewLine); } public monospaceAssumptionsAreValid(): boolean { if (!this._renderedViewLine) { return monospaceAssumptionsAreValid; } if (this._renderedViewLine instanceof FastRenderedViewLine) { return this._renderedViewLine.monospaceAssumptionsAreValid(); } return monospaceAssumptionsAreValid; } public onMonospaceAssumptionsInvalidated(): void { if (this._renderedViewLine && this._renderedViewLine instanceof FastRenderedViewLine) { this._renderedViewLine = this._renderedViewLine.toSlowRenderedLine(); } } </ins> public getVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): VisibleRanges | null { if (!this._renderedViewLine) { return null;

return true; } <ins> public monospaceAssumptionsAreValid(): boolean { if (!this.domNode) { return monospaceAssumptionsAreValid; } const expectedWidth = this.getWidth(); const actualWidth = (<HTMLSpanElement>this.domNode.domNode.firstChild).offsetWidth; if (Math.abs(expectedWidth - actualWidth) >= 2) { // more than 2px off console.warn(`monospace assumptions have been violated, therefore disabling monospace optimizations!`); monospaceAssumptionsAreValid = false; } return monospaceAssumptionsAreValid; } public toSlowRenderedLine(): RenderedViewLine { return createRenderedLine(this.domNode, this.input, this._characterMapping, false, ForeignElementType.None); } </ins> public getVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] | null { const startPosition = this._getCharPosition(startColumn); const endPosition = this._getCharPosition(endColumn);

*--------------------------------------------------------------------------------------------*/ import 'vs/css!./viewLines'; <ins> import * as platform from 'vs/base/common/platform'; </ins> import { FastDomNode } from 'vs/base/browser/fastDomNode'; import { RunOnceScheduler } from 'vs/base/common/async'; import { Configuration } from 'vs/editor/browser/config/configuration';

// --- width private _maxLineWidth: number; private readonly _asyncUpdateLineWidths: RunOnceScheduler; <ins> private readonly _asyncCheckMonospaceFontAssumptions: RunOnceScheduler; </ins> private _horizontalRevealRequest: HorizontalRevealRequest | null; private readonly _lastRenderedData: LastRenderedData;

this._asyncUpdateLineWidths = new RunOnceScheduler(() => { this._updateLineWidthsSlow(); }, 200); <ins> this._asyncCheckMonospaceFontAssumptions = new RunOnceScheduler(() => { this._checkMonospaceFontAssumptions(); }, 2000); </ins> this._lastRenderedData = new LastRenderedData();

public dispose(): void { this._asyncUpdateLineWidths.dispose(); <ins> this._asyncCheckMonospaceFontAssumptions.dispose(); </ins> super.dispose(); }

return allWidthsComputed; } <ins> private _checkMonospaceFontAssumptions(): void { // Problems with monospace assumptions are more apparent for longer lines, // as small rounding errors start to sum up, so we will select the longest // line for a closer inspection let longestLineNumber = -1; let longestWidth = -1; const rendStartLineNumber = this._visibleLines.getStartLineNumber(); const rendEndLineNumber = this._visibleLines.getEndLineNumber(); for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) { const visibleLine = this._visibleLines.getVisibleLine(lineNumber); if (visibleLine.needsMonospaceFontCheck()) { const lineWidth = visibleLine.getWidth(); if (lineWidth > longestWidth) { longestWidth = lineWidth; longestLineNumber = lineNumber; } } } if (longestLineNumber === -1) { return; } if (!this._visibleLines.getVisibleLine(longestLineNumber).monospaceAssumptionsAreValid()) { for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) { const visibleLine = this._visibleLines.getVisibleLine(lineNumber); visibleLine.onMonospaceAssumptionsInvalidated(); } } } </ins> public prepareRender(): void { throw new Error('Not supported'); }

this._asyncUpdateLineWidths.schedule(); } <ins> if (platform.isLinux && !this._asyncCheckMonospaceFontAssumptions.isScheduled()) { const rendStartLineNumber = this._visibleLines.getStartLineNumber(); const rendEndLineNumber = this._visibleLines.getEndLineNumber(); for (let lineNumber = rendStartLineNumber; lineNumber <= rendEndLineNumber; lineNumber++) { const visibleLine = this._visibleLines.getVisibleLine(lineNumber); if (visibleLine.needsMonospaceFontCheck()) { this._asyncCheckMonospaceFontAssumptions.schedule(); break; } } } </ins> // (3) handle scrolling this._linesContent.setLayerHinting(this._canUseLayerHinting); this._linesContent.setContain('strict');