mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-15 18:02:58 +08:00
chore: scroll to the bottom after pressed any key (#553)
This commit is contained in:
@@ -79,6 +79,8 @@ class TerminalPanelKeyAdapter(
|
|||||||
val encode = terminal.getKeyEncoder().encode(AWTTerminalKeyEvent(e))
|
val encode = terminal.getKeyEncoder().encode(AWTTerminalKeyEvent(e))
|
||||||
if (encode.isNotEmpty()) {
|
if (encode.isNotEmpty()) {
|
||||||
writer.write(TerminalWriter.WriteRequest.fromBytes(encode.toByteArray(writer.getCharset())))
|
writer.write(TerminalWriter.WriteRequest.fromBytes(encode.toByteArray(writer.getCharset())))
|
||||||
|
// scroll to bottom
|
||||||
|
terminal.getScrollingModel().scrollTo(Int.MAX_VALUE)
|
||||||
e.consume()
|
e.consume()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +93,8 @@ class TerminalPanelKeyAdapter(
|
|||||||
if (isAltPressedOnly(e) && Character.isDefined(e.keyChar)) {
|
if (isAltPressedOnly(e) && Character.isDefined(e.keyChar)) {
|
||||||
val c = String(charArrayOf(ASCII_ESC, simpleMapKeyCodeToChar(e)))
|
val c = String(charArrayOf(ASCII_ESC, simpleMapKeyCodeToChar(e)))
|
||||||
writer.write(TerminalWriter.WriteRequest.fromBytes(c.toByteArray(writer.getCharset())))
|
writer.write(TerminalWriter.WriteRequest.fromBytes(c.toByteArray(writer.getCharset())))
|
||||||
|
// scroll to bottom
|
||||||
|
terminal.getScrollingModel().scrollTo(Int.MAX_VALUE)
|
||||||
e.consume()
|
e.consume()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user