Compare commits
1 Commits
v0.2.16-ma
...
v0.2.17-ma
| Author | SHA1 | Date | |
|---|---|---|---|
| d34e8e2c6d |
@@ -197,13 +197,12 @@ export default function TerminalView({ sessionId, active }: Props) {
|
|||||||
|
|
||||||
const outputPromise = onOutput(sessionId, (data) => {
|
const outputPromise = onOutput(sessionId, (data) => {
|
||||||
if (aborted) return;
|
if (aborted) return;
|
||||||
const shouldFollow = isAtBottomRef.current;
|
|
||||||
term.write(data, () => {
|
term.write(data, () => {
|
||||||
// Keep viewport pinned to bottom when user hasn't scrolled up
|
// Keep viewport pinned to bottom when user hasn't scrolled up.
|
||||||
if (shouldFollow) {
|
// Check ref at callback time (not capture time) so that a user
|
||||||
|
// scroll-up between the write() call and callback is respected.
|
||||||
|
if (isAtBottomRef.current) {
|
||||||
term.scrollToBottom();
|
term.scrollToBottom();
|
||||||
isAtBottomRef.current = true;
|
|
||||||
setIsAtBottom(true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
detector.feed(data);
|
detector.feed(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user