提交 f820a9a9 编写于 作者: I isidor

fixes #83906

上级 f24f4834
......@@ -809,13 +809,13 @@ class ReplDelegate extends CachedListVirtualDelegate<IReplElement> {
const config = this.configurationService.getValue<IDebugConfiguration>('debug');
if (!config.console.wordWrap) {
return Math.ceil(1.4 * config.console.fontSize);
return this.estimateHeight(element, true);
}
return super.getHeight(element);
}
protected estimateHeight(element: IReplElement): number {
protected estimateHeight(element: IReplElement, ignoreValueLength = false): number {
const config = this.configurationService.getValue<IDebugConfiguration>('debug');
const rowHeight = Math.ceil(1.4 * config.console.fontSize);
const countNumberOfLines = (str: string) => Math.max(1, (str && str.match(/\r\n|\n/g) || []).length);
......@@ -825,7 +825,7 @@ class ReplDelegate extends CachedListVirtualDelegate<IReplElement> {
// For every 30 characters increase the number of lines needed
if (hasValue(element)) {
let value = element.value;
let valueRows = countNumberOfLines(value) + Math.floor(value.length / 30);
let valueRows = countNumberOfLines(value) + (ignoreValueLength ? 0 : Math.floor(value.length / 30));
return valueRows * rowHeight;
}
......
......@@ -10,7 +10,7 @@ import { ExpressionContainer } from 'vs/workbench/contrib/debug/common/debugMode
import { isString, isUndefinedOrNull, isObject } from 'vs/base/common/types';
import { basenameOrAuthority } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { endsWith, startsWith } from 'vs/base/common/strings';
import { endsWith } from 'vs/base/common/strings';
import { generateUuid } from 'vs/base/common/uuid';
import { Emitter } from 'vs/base/common/event';
......@@ -134,7 +134,7 @@ export class ReplModel {
if (typeof data === 'string') {
const previousElement = this.replElements.length ? this.replElements[this.replElements.length - 1] : undefined;
if (!startsWith(data, '\n') && previousElement instanceof SimpleReplElement && previousElement.severity === sev && !endsWith(previousElement.value, '\n') && !endsWith(previousElement.value, '\r\n')) {
if (previousElement instanceof SimpleReplElement && previousElement.severity === sev && !endsWith(previousElement.value, '\n') && !endsWith(previousElement.value, '\r\n')) {
previousElement.value += data;
this._onDidChangeElements.fire();
} else {
......
......@@ -498,13 +498,11 @@ suite('Debug - Model', () => {
repl.appendToRepl(session, '3\n4', severity.Info);
repl.appendToRepl(session, '5\n', severity.Info);
repl.appendToRepl(session, '6', severity.Info);
repl.appendToRepl(session, '\n7', severity.Info);
elements = <SimpleReplElement[]>repl.getReplElements();
assert.equal(elements.length, 4);
assert.equal(elements.length, 3);
assert.equal(elements[0], '1\n');
assert.equal(elements[1], '23\n45\n');
assert.equal(elements[2], '6');
assert.equal(elements[3], '\n7');
});
test('repl merging', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册