chore: scroll to the bottom after pressed any key (#553)

This commit is contained in:
hstyi
2025-05-01 08:36:51 +08:00
committed by GitHub
parent 71c0751692
commit 96da7eac41

View File

@@ -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
}