Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9e1b8b8
Reflect broken symlinks in resources model
iloveeclipse Jul 3, 2026
ee286af
Version bump(s) for 4.42 stream
eclipse-platform-bot Sep 2, 2026
52808e9
Preserve breakpoint check state across filter changes
SougandhS Aug 17, 2026
04a2118
Add IWatchExpressionCellEditorFactory for content-assist in Exp view
SougandhS Oct 3, 2026
bdf2229
Open launch config dialog on Ctrl+click of Run As / Debug As shortcut
SougandhS Oct 13, 2026
34cc4d3
Fix stack trace detection does not work in colored console #535
NikRom5531 Oct 17, 2026
46235aa
Fix broken launch config dialog UI after unsaved-changes prompt on macOS
SougandhS Oct 9, 2026
8260564
Fix NPE in DocumentMerger.doDiff #123
ravnskjaer Oct 27, 2026
d74105c
Fix OutputStreamMonitor.getContents() corrupting a split multibyte ch…
dimitribekale Nov 5, 2026
a6ccf4e
Terminal: grapheme clusters, with the cell layout kept by the text data
insjang Sep 2, 2026
6b101ba
Let a launch override the standard input file of its configuration
anydoby Oct 15, 2026
b31204a
Read the append attribute only when a configuration exists
anydoby Nov 9, 2026
844e234
Terminal: send Shift+Tab, Delete, Ctrl+Alt and Ctrl+digit keys as xte…
insjang Nov 11, 2026
d359f3d
Terminal: support synchronized output (DEC mode 2026)
insjang Nov 13, 2026
1c638ae
Ignore the initialization job of a replaced compare editor input
vogella Nov 13, 2026
d810c92
Add UnifiedDiff API to dispose the editor display
tobiasmelcher Nov 13, 2026
4856183
Fix unified diff rendering with taller emoji glyphs
tobiasmelcher Nov 13, 2026
e2041dc
Add Preview button to String Substitution preference page
SougandhS Nov 8, 2026
6d3e0b5
Terminal: report the mouse to programs that ask for it
insjang Nov 13, 2026
60c1866
Fold up2798 into the superset
hsoliwal Nov 16, 2026
1753218
Fold up2880 into the superset
hsoliwal Nov 16, 2026
79b2725
Fold up2902 into the superset
hsoliwal Nov 16, 2026
06a0d5d
Fold up2904 into the superset
hsoliwal Nov 16, 2026
c8fc724
Fold up2989 into the superset
hsoliwal Nov 16, 2026
cedbaa1
Fold up2990 into the superset
hsoliwal Nov 16, 2026
3b68a59
Fold up3003 into the superset
hsoliwal Nov 16, 2026
f372e8f
Fold up3021 into the superset
hsoliwal Nov 16, 2026
2d8b6e2
Fold up3026 into the superset
hsoliwal Nov 16, 2026
a68815a
Fold up3060 into the superset
hsoliwal Nov 16, 2026
9e7fc96
Fold up3062 into the superset
hsoliwal Nov 16, 2026
6511c28
Fold up3065 into the superset
hsoliwal Nov 16, 2026
9ce2a81
Fold up3066 into the superset
hsoliwal Nov 16, 2026
9d2e8b5
Fold up3067 into the superset
hsoliwal Nov 16, 2026
ad87237
Fold up3072 into the superset
hsoliwal Nov 16, 2026
50e2093
Fold up3073 into the superset
hsoliwal Nov 16, 2026
45b74ad
Fold up3074 into the superset
hsoliwal Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public class OutputStreamMonitor implements IBinaryStreamMonitor {
* of an incomplete character.
*/
private StreamDecoder fBufferedDecoder;
/** Decoded form of the first {@link #fDecodedLength} bytes of {@link #fContents}. */
private String fCachedDecodedContents;
private int fDecodedLength;

/**
* The thread which reads from the stream
Expand Down Expand Up @@ -193,11 +195,12 @@ public synchronized String getContents() {
if (!isBuffered()) {
return ""; //$NON-NLS-1$
}
if (fCachedDecodedContents != null) {
return fCachedDecodedContents;
if (fDecodedLength < fContents.size()) {
// decode only the bytes not yet fed to the stateful decoder
byte[] data = getData();
fCachedDecodedContents += fBufferedDecoder.decode(data, fDecodedLength, data.length - fDecodedLength);
fDecodedLength = data.length;
}
byte[] data = getData();
fCachedDecodedContents = fBufferedDecoder.decode(data, 0, data.length);
return fCachedDecodedContents;
}

Expand Down Expand Up @@ -236,7 +239,6 @@ private void internalRead() {
if (read > 0) {
synchronized (this) {
if (isBuffered()) {
fCachedDecodedContents = null;
fContents.write(buffer, 0, read);
}
fireStreamAppended(buffer, 0, read);
Expand Down Expand Up @@ -306,7 +308,8 @@ protected void startMonitoring(String name) {
@Override
public synchronized void setBuffered(boolean buffer) {
if (isBuffered() != buffer) {
fCachedDecodedContents = null;
fCachedDecodedContents = ""; //$NON-NLS-1$
fDecodedLength = 0;
if (buffer) {
fContents = new ByteArrayOutputStream();
fBufferedDecoder = new StreamDecoder(fCharset == null ? Charset.defaultCharset() : fCharset);
Expand All @@ -320,7 +323,8 @@ public synchronized void setBuffered(boolean buffer) {
@Override
public synchronized void flushContents() {
if (isBuffered()) {
fCachedDecodedContents = null;
fCachedDecodedContents = ""; //$NON-NLS-1$
fDecodedLength = 0;
fContents.reset();
}
}
Expand Down
2 changes: 1 addition & 1 deletion debug/org.eclipse.debug.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.tests;singleton:=true
Bundle-Version: 3.15.400.qualifier
Bundle-Version: 3.15.500.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.208.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.34.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.eclipse.debug.tests.console.ConsoleManagerTests;
import org.eclipse.debug.tests.console.ConsoleOutputLineTruncateTest;
import org.eclipse.debug.tests.console.ConsoleOutputLineWrapTest;
import org.eclipse.debug.tests.console.ConsolePatternMatcherTests;
import org.eclipse.debug.tests.console.ConsoleShowHideTests;
import org.eclipse.debug.tests.console.ConsoleTests;
import org.eclipse.debug.tests.console.FileLinkTests;
Expand All @@ -33,7 +34,7 @@
import org.eclipse.debug.tests.console.ProcessConsoleTests;
import org.eclipse.debug.tests.console.RuntimeProcessTests;
import org.eclipse.debug.tests.console.StreamsProxyTests;
import org.eclipse.debug.tests.console.TextConsoleViewerTest;
import org.eclipse.debug.tests.console.StyleRangeUtilTest;
import org.eclipse.debug.tests.launching.AcceleratorSubstitutionTests;
import org.eclipse.debug.tests.launching.ArgumentParsingTests;
import org.eclipse.debug.tests.launching.LaunchConfigurationTests;
Expand Down Expand Up @@ -127,11 +128,12 @@
IOConsoleTests.class, //
ConsoleOutputLineWrapTest.class, //
ConsoleOutputLineTruncateTest.class, //
ConsolePatternMatcherTests.class, //
IOConsoleFixedWidthTests.class, //
ProcessConsoleManagerTests.class, //
ProcessConsoleTests.class, //
StreamsProxyTests.class, //
TextConsoleViewerTest.class, //
StyleRangeUtilTest.class, //
RuntimeProcessTests.class, //
OutputStreamMonitorTests.class, //
InputStreamMonitorTests.class, //
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*******************************************************************************
* Copyright (c) 2026 and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which accompanies this distribution,
* and is available at https://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.debug.tests.console;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.tests.DebugTestExtension;
import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IPatternMatchListener;
import org.eclipse.ui.console.PatternMatchEvent;
import org.eclipse.ui.console.TextConsole;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

/**
* Tests {@code ConsolePatternMatcher} pattern matching on console text that
* contains ANSI escape sequences.
* <p>
* Patterns are matched against the text with the escape sequences removed and
* the reported {@link PatternMatchEvent} range is mapped back to the raw
* document. The range must cover exactly the matched text plus any escape
* sequences located inside the match. Escape sequences before or after the
* match must not be part of the range, otherwise listeners that trim the
* reported range would trim an invisible escape character instead of the
* visible one.
* </p>
*/
@ExtendWith(DebugTestExtension.class)
public class ConsolePatternMatcherTests {

private static final String FILE_LINK_PATTERN = "\\([^\\s]*\\.java:\\d+\\)"; //$NON-NLS-1$

private IOConsole console;

@BeforeEach
public void setUp() {
console = new IOConsole("ConsolePatternMatcherTests", "test", null); //$NON-NLS-1$ //$NON-NLS-2$
}

@Test
public void testFileLinkWithTrailingEscape() throws Exception {
String text = "\tat org.example.Demo.main(Demo.java:10)\u001b[0m\n"; //$NON-NLS-1$
PatternMatchEvent event = match(text);
assertMatch(text, event, "(Demo.java:10)"); //$NON-NLS-1$
}

@Test
public void testFileLinkWithInternalEscapes() throws Exception {
String text = "\tat org.example.Demo.main(\u001b[1mDemo.java:10\u001b[m)\n"; //$NON-NLS-1$
PatternMatchEvent event = match(text);
assertMatch(text, event, "(\u001b[1mDemo.java:10\u001b[m)"); //$NON-NLS-1$
}

@Test
public void testFileLinkWithLeadingEscape() throws Exception {
String text = "\tat org.example.Demo.main \u001b[1m(Demo.java:10)\n"; //$NON-NLS-1$
PatternMatchEvent event = match(text);
assertMatch(text, event, "(Demo.java:10)"); //$NON-NLS-1$
}

@Test
public void testFileLinkWithoutEscapes() throws Exception {
String text = "\tat org.example.Demo.main(Demo.java:10)\n"; //$NON-NLS-1$
PatternMatchEvent event = match(text);
assertMatch(text, event, "(Demo.java:10)"); //$NON-NLS-1$
}

@Test
public void testMultipleFileLinksWithEscapes() throws Exception {
String text = "\u001b[31mCaused by: java.lang.NullPointerException\u001b[m\n" //$NON-NLS-1$
+ "\tat org.example.Demo.main(\u001b[1mDemo.java:10\u001b[m)\n" //$NON-NLS-1$
+ "\tat org.example.Other.run(\u001b[1mOther.java:42\u001b[m)\n"; //$NON-NLS-1$
List<PatternMatchEvent> events = matchAll(text);
assertEquals(2, events.size());
assertMatch(text, events.get(0), "(\u001b[1mDemo.java:10\u001b[m)"); //$NON-NLS-1$
assertMatch(text, events.get(1), "(\u001b[1mOther.java:42\u001b[m)"); //$NON-NLS-1$
}

private PatternMatchEvent match(String text) throws Exception {
List<PatternMatchEvent> events = matchAll(text);
assertEquals(1, events.size(), () -> "expected exactly one match in: " + text); //$NON-NLS-1$
return events.get(0);
}

private List<PatternMatchEvent> matchAll(String text) throws Exception {
List<PatternMatchEvent> events = new CopyOnWriteArrayList<>();
console.addPatternMatchListener(new CollectingMatchListener(events));
console.getDocument().set(text);
// the match job family is the console itself
Job.getJobManager().join(console, null);
return events;
}

private static void assertMatch(String text, PatternMatchEvent event, String rawMatch) {
assertEquals(text.indexOf(rawMatch), event.getOffset(), rawMatch);
assertEquals(rawMatch.length(), event.getLength(), rawMatch);
}

private static final class CollectingMatchListener implements IPatternMatchListener {

private final List<PatternMatchEvent> events;

CollectingMatchListener(List<PatternMatchEvent> events) {
this.events = events;
}

@Override
public void connect(TextConsole console) {
// nothing to do
}

@Override
public void disconnect() {
// nothing to do
}

@Override
public void matchFound(PatternMatchEvent event) {
events.add(event);
}

@Override
public String getPattern() {
return FILE_LINK_PATTERN;
}

@Override
public int getCompilerFlags() {
return 0;
}

@Override
public String getLineQualifier() {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,30 @@ public void testBufferedOutputStreamMonitor() throws Exception {
binaryListener.assertNoExceptions();
}

/**
* A multibyte character split across two reads must not be corrupted when
* getContents() is called after each read without flushing in between.
*/
@Test
public void testBufferedContentsWithSplitCharacterAndNoFlush() throws Exception {
String input = "o\u00F6O";
byte[] byteInput = input.getBytes(StandardCharsets.UTF_8);
BinaryListener binaryListener = new BinaryListener();
monitor.addBinaryListener(binaryListener);

sysout.write(byteInput, 0, 2);
sysout.flush();
monitor.startMonitoring();
binaryListener.waitForBytes(2);
assertThat(monitor.getContents()).isEqualTo(input.substring(0, 1));

sysout.write(byteInput, 2, byteInput.length - 2);
sysout.flush();
binaryListener.waitForBytes(byteInput.length);
assertThat(monitor.getContents()).isEqualTo(input);
binaryListener.assertNoExceptions();
}

/**
* Simple test for output stream monitor. Test listeners without buffering.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,71 @@ public void testInputFromFileSendsEof() throws Exception {
assertThat(receivedInput).as("received input").isEqualTo(input);
}

/**
* Test that a process reads its standard input from a file set on its launch
* when it has no launch configuration.
*/
@Test
public void testInputFromLaunchAttribute() throws Exception {
byte[] input = "from launch\n".getBytes(StandardCharsets.US_ASCII);
String consoleEncoding = StandardCharsets.UTF_8.name();

final File inFile = createTmpFile("testinput-launch.txt");
Files.write(inFile.toPath(), input);
final MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
try {
final IProcess process = mockProcess.toRuntimeProcess("inputFromLaunch");
process.getLaunch().setAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, inFile.getCanonicalPath());
final ProcessConsole console = new ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
try {
console.initialize();
waitWhile(() -> !mockProcess.isStdinClosed(), () -> "Process stdin was not closed after input file was read.");
} finally {
console.destroy();
}
} finally {
mockProcess.destroy();
}

assertThat(mockProcess.getReceivedInput()).as("received input").isEqualTo(input);
}

/**
* Test that an input file set on the launch is supplied instead of the input
* file of its launch configuration.
*/
@Test
public void testInputFromLaunchAttributeOverridesConfiguration() throws Exception {
byte[] launchInput = "from launch\n".getBytes(StandardCharsets.US_ASCII);
byte[] configurationInput = "from configuration\n".getBytes(StandardCharsets.US_ASCII);
String consoleEncoding = StandardCharsets.UTF_8.name();

final File launchFile = createTmpFile("testinput-launch.txt");
Files.write(launchFile.toPath(), launchInput);
final File configurationFile = createTmpFile("testinput-configuration.txt");
Files.write(configurationFile.toPath(), configurationInput);
final MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
try {
Map<String, Object> launchConfigAttributes = new HashMap<>();
launchConfigAttributes.put(DebugPlugin.ATTR_CONSOLE_ENCODING, consoleEncoding);
launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, configurationFile.getCanonicalPath());
launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
final IProcess process = mockProcess.toRuntimeProcess("inputFromLaunchOverride", launchConfigAttributes);
process.getLaunch().setAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, launchFile.getCanonicalPath());
final ProcessConsole console = new ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
try {
console.initialize();
waitWhile(() -> !mockProcess.isStdinClosed(), () -> "Process stdin was not closed after input file was read.");
} finally {
console.destroy();
}
} finally {
mockProcess.destroy();
}

assertThat(mockProcess.getReceivedInput()).as("received input").isEqualTo(launchInput);
}

/**
* Test that console name updates (elapsed time) only happen for visible
* consoles. Hidden consoles should not update their name. When a hidden
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 Paul Pazderski and others.
* Copyright (c) 2019, 2026 Paul Pazderski and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -25,16 +25,15 @@
import org.eclipse.debug.tests.DebugTestExtension;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.console.TextConsoleViewer;
import org.eclipse.ui.internal.console.StyleRangeUtil;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

/**
* Not really a test for {@link TextConsoleViewer} yet since it only test one
* private method of it.
* Test for the style range override helper in {@link StyleRangeUtil}.
*/
@ExtendWith(DebugTestExtension.class)
public class TextConsoleViewerTest {
public class StyleRangeUtilTest {

/**
* Test override of existing styles with a new style. Typically used to
Expand All @@ -48,7 +47,7 @@ public void testStyleOverride() throws Throwable {
Color colorK = null;
Color colorW = null;
try {
final Method method = TextConsoleViewer.class.getDeclaredMethod("overrideStyleRange", List.class, StyleRange.class);
final Method method = StyleRangeUtil.class.getDeclaredMethod("overrideStyleRange", List.class, StyleRange.class);
method.setAccessible(true);
assertTrue(Modifier.isStatic(method.getModifiers()), "Required method <\" + method + \"> is not static.\"");

Expand Down
2 changes: 1 addition & 1 deletion debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true
Bundle-Version: 3.22.100.qualifier
Bundle-Version: 3.23.0.qualifier
Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Loading