From 183b862e147bdd2a39b9d49e2947a38ef1237aa9 Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:41:12 +0000 Subject: [PATCH] GP-5416: Fix annoying Terminal scrolling when selecting. --- .../ghidra/app/plugin/core/terminal/TerminalPanel.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalPanel.java index 9c591b8c76..e233aa605b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalPanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalPanel.java @@ -39,8 +39,7 @@ import ghidra.app.plugin.core.terminal.TerminalFinder.TextTerminalFinder; import ghidra.app.plugin.core.terminal.vt.*; import ghidra.app.plugin.core.terminal.vt.VtHandler.*; import ghidra.app.services.ClipboardService; -import ghidra.util.ColorUtils; -import ghidra.util.Msg; +import ghidra.util.*; /** * A VT100 terminal emulator in a panel. @@ -466,9 +465,13 @@ public class TerminalPanel extends JPanel implements FieldLocationListener, Fiel * Prevent the user from doing this. Cursor location is controlled by pty. While we've * prevented key strokes from causing this, we've not prevented mouse clicks from doing it. * Next best thing is to just move it back. + * + * NOTE: We schedule the cursor re-placement for later, because the FieldPanel may be about + * to scroll to the cursor. If we re-place immediately, it will likely scroll to the bottom + * of the terminal. This is especially annoying when the user is trying to make a selection. */ if (trigger == EventTrigger.GUI_ACTION) { - placeCursor(false); + Swing.runLater(() -> placeCursor(false)); } }