From 728f1f2802761de8cd9ac16d82d1140a5679f5ab Mon Sep 17 00:00:00 2001 From: hstyi Date: Thu, 10 Jul 2025 09:52:14 +0800 Subject: [PATCH] fix: xterm ScrollRegion --- .../terminal/ControlSequenceIntroducerProcessor.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/termora/terminal/ControlSequenceIntroducerProcessor.kt b/src/main/kotlin/app/termora/terminal/ControlSequenceIntroducerProcessor.kt index 6d2c790..4f3c18a 100644 --- a/src/main/kotlin/app/termora/terminal/ControlSequenceIntroducerProcessor.kt +++ b/src/main/kotlin/app/termora/terminal/ControlSequenceIntroducerProcessor.kt @@ -342,7 +342,10 @@ class ControlSequenceIntroducerProcessor(terminal: Terminal, reader: TerminalRea } // 设置滚动区域 - terminal.getTerminalModel().setData(DataKey.ScrollingRegion, ScrollingRegion(top, bottom)) + terminal.getTerminalModel().setData( + DataKey.ScrollingRegion, + ScrollingRegion(top, min(bottom, terminalModel.getRows())) + ) if (log.isDebugEnabled) { log.debug("Set Scrolling Region [${top}; ${bottom}]") @@ -715,6 +718,13 @@ class ControlSequenceIntroducerProcessor(terminal: Terminal, reader: TerminalRea } } + // Alternate Screen Buffer + 47, 1047 -> { + // clear selection + terminal.getSelectionModel().clearSelection() + terminalModel.setData(DataKey.AlternateScreenBuffer, enable) + } + // Alternate Screen Buffer // https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer 1049 -> {