From 96da7eac4164058085e6a3288cdbe54bb533691d Mon Sep 17 00:00:00 2001 From: hstyi Date: Thu, 1 May 2025 08:36:51 +0800 Subject: [PATCH] chore: scroll to the bottom after pressed any key (#553) --- .../app/termora/terminal/panel/TerminalPanelKeyAdapter.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/app/termora/terminal/panel/TerminalPanelKeyAdapter.kt b/src/main/kotlin/app/termora/terminal/panel/TerminalPanelKeyAdapter.kt index 91767e9..90cb434 100644 --- a/src/main/kotlin/app/termora/terminal/panel/TerminalPanelKeyAdapter.kt +++ b/src/main/kotlin/app/termora/terminal/panel/TerminalPanelKeyAdapter.kt @@ -79,6 +79,8 @@ class TerminalPanelKeyAdapter( val encode = terminal.getKeyEncoder().encode(AWTTerminalKeyEvent(e)) if (encode.isNotEmpty()) { writer.write(TerminalWriter.WriteRequest.fromBytes(encode.toByteArray(writer.getCharset()))) + // scroll to bottom + terminal.getScrollingModel().scrollTo(Int.MAX_VALUE) e.consume() } @@ -91,6 +93,8 @@ class TerminalPanelKeyAdapter( if (isAltPressedOnly(e) && Character.isDefined(e.keyChar)) { val c = String(charArrayOf(ASCII_ESC, simpleMapKeyCodeToChar(e))) writer.write(TerminalWriter.WriteRequest.fromBytes(c.toByteArray(writer.getCharset()))) + // scroll to bottom + terminal.getScrollingModel().scrollTo(Int.MAX_VALUE) e.consume() return }