Skip to content

Make double buffering of Terminal adopt to higher monitor zooms#2473

Open
HeikoKlare wants to merge 2 commits intoeclipse-platform:masterfrom
vi-eclipse:issue-2191
Open

Make double buffering of Terminal adopt to higher monitor zooms#2473
HeikoKlare wants to merge 2 commits intoeclipse-platform:masterfrom
vi-eclipse:issue-2191

Conversation

@HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Feb 25, 2026

The terminal implementation uses a custom double buffering implementation for rendering the current line. On most Platforms (Linux and MacOS) the current implementation will always render the double-buffered image at 100% zoom, even if the target zoom is higher.

This change adapts the implementation to directly render into the actual control and enable native double buffering for the control instead. This ensures that the contents are rendered at the actual target zoom, producing sharper results on HiDPI monitors when using MacOS or Linux.

Fixes #2295

Fixes #2191

How to reproduce

MacOS

On MacOS, have a two monitor setup with one high-resolution and one low-resolution monitor. Start the application on the low-resolution monitor and move the window over to the high-resolution monitor.

Without this change:
image

With this change:
image

Linux

On Linux, a single monitor setup with a monitor zoom > 100% is sufficient. It also happens with fractional scales. In the following, you see the appearance with 125% monitor zoom.

Without this change:
image

With this change:
image

@HeikoKlare HeikoKlare force-pushed the issue-2191 branch 2 times, most recently from c940705 to 0e4de06 Compare February 25, 2026 10:13
@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Test Results

 1 980 files  ±0   1 980 suites  ±0   1h 33m 20s ⏱️ + 1m 14s
 4 746 tests ±0   4 722 ✅ ±0   24 💤 ±0  0 ❌ ±0 
14 238 runs  ±0  14 056 ✅ ±0  182 💤 ±0  0 ❌ ±0 

Results for commit 7714171. ± Comparison against base commit 3750de9.

♻️ This comment has been updated with latest results.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the terminal text rendering path to avoid custom per-line image double buffering (which rendered at 100% scale on some platforms), and instead relies on rendering directly to the control with SWT native double buffering so output stays sharp on HiDPI / fractional scaling (MacOS/Linux).

Changes:

  • Remove per-line Image back-buffer rendering in TextLineRenderer and draw directly to the provided GC.
  • Enable SWT native double buffering on TextCanvas via SWT.DOUBLE_BUFFERED.
  • Adjust underline drawing API to accept screen offsets (but see comments for a positioning bug).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/TextLineRenderer.java Switches line rendering from manual Image double buffer to direct GC painting; updates underline drawing to use offsets.
terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/TextCanvas.java Enables SWT native double buffering for the terminal canvas control.
Comments suppressed due to low confidence (1)

terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/TextLineRenderer.java:191

  • drawUnderline(...) uses absolute colStart/colEnd to compute x/x2, but drawLine(...) is often called for a clipped column range (colFirst may be > 0) where x is the screen origin for colFirst. This will misplace the underline whenever the paint clip starts mid-line (and x2 also currently ignores xOffset). Consider computing underline coordinates relative to colFirst (or pass colFirst into drawUnderline) and include xOffset when computing x2 so the line aligns with drawText(...) offsets.
	private void drawUnderline(GC gc, int xOffset, int yOffset, int colStart, int colEnd) {
		int y = yOffset + getCellHeight() - 1;
		int x = xOffset + getCellWidth() * colStart;

		// x2 is the right side of last column being underlined.
		int x2 = (colEnd + 1) * getCellWidth() - 1;
		gc.drawLine(x, y, x2, y);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The terminal implementation uses a custom double buffering
implementation for rendering the current line. On most Platforms (Linux
and MacOS) the current implementation will always render the
double-buffered image at 100% zoom, even if the target zoom is higher.

This change adapts the implementation to directly render into the actual
control and enable native double buffering for the control instead. This
ensures that the contents are rendered at the actual target zoom,
producing sharper results on HiDPI monitors when using MacOS or Linux.

Fixes eclipse-platform#2295

Fixes eclipse-platform#2191
# Conflicts:
#	terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/TextLineRenderer.java
@eclipse-platform-bot
Copy link
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

terminal/bundles/org.eclipse.terminal.control/META-INF/MANIFEST.MF
terminal/features/org.eclipse.terminal.feature/feature.xml

Warning

🚧 This PR cannot be modified by maintainers because edits are disabled or it is created from an organization repository. To obtain the required changes apply the git patch manually as an additional commit.

Git patch
From c2aaf2cbc91cf76bad7f385cd61e1b93c226c94c Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Mon, 2 Mar 2026 13:36:44 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/terminal/bundles/org.eclipse.terminal.control/META-INF/MANIFEST.MF b/terminal/bundles/org.eclipse.terminal.control/META-INF/MANIFEST.MF
index 7e5c81cce0..5b19142d13 100644
--- a/terminal/bundles/org.eclipse.terminal.control/META-INF/MANIFEST.MF
+++ b/terminal/bundles/org.eclipse.terminal.control/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.terminal.control; singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.1.100.qualifier
 Bundle-Activator: org.eclipse.terminal.internal.control.impl.TerminalPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/terminal/features/org.eclipse.terminal.feature/feature.xml b/terminal/features/org.eclipse.terminal.feature/feature.xml
index a273750f1c..94b37131c2 100644
--- a/terminal/features/org.eclipse.terminal.feature/feature.xml
+++ b/terminal/features/org.eclipse.terminal.feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.terminal.feature"
       label="%featureName"
-      version="1.0.200.qualifier"
+      version="1.0.300.qualifier"
       provider-name="%providerName"
       license-feature="org.eclipse.license"
       license-feature-version="0.0.0">
-- 
2.53.0

Further information are available in Common Build Issues - Missing version increments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants