提交 247907cd 编写于 作者: I isidor

fix Debug console stop listening output

fixes #83906
上级 81275d9c
......@@ -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 } from 'vs/base/common/strings';
import { endsWith, startsWith } from 'vs/base/common/strings';
import { generateUuid } from 'vs/base/common/uuid';
import { Emitter } from 'vs/base/common/event';
......@@ -134,8 +134,9 @@ export class ReplModel {
if (typeof data === 'string') {
const previousElement = this.replElements.length ? this.replElements[this.replElements.length - 1] : undefined;
if (previousElement instanceof SimpleReplElement && previousElement.severity === sev && !endsWith(previousElement.value, '\n') && !endsWith(previousElement.value, '\r\n')) {
if (!startsWith(data, '\n') && previousElement instanceof SimpleReplElement && previousElement.severity === sev && !endsWith(previousElement.value, '\n') && !endsWith(previousElement.value, '\r\n')) {
previousElement.value += data;
this._onDidChangeElements.fire();
} else {
const element = new SimpleReplElement(session, `topReplElement:${topReplElementCounter++}`, data, sev, source);
this.addReplElement(element);
......
......@@ -498,11 +498,13 @@ 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, 3);
assert.equal(elements.length, 4);
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.
先完成此消息的编辑!
想要评论请 注册