@@ -601,7 +624,7 @@ class ScreenWindowView extends React.Component<{sw : ScreenWindow}, {}> {
if (sw && sw.shouldFollow.get() != atBottom) {
mobx.action(() => sw.shouldFollow.set(atBottom))();
}
- // console.log("scroll-handler>", atBottom, target.scrollTop, target.scrollHeight);
+ // console.log("scroll-handler (sw)>", atBottom, target.scrollTop, target.scrollHeight, event);
}
componentDidMount() {
diff --git a/src/model.ts b/src/model.ts
index ca138691..49f366d9 100644
--- a/src/model.ts
+++ b/src/model.ts
@@ -885,10 +885,6 @@ class Model {
return;
}
termWrap.terminal.focus();
- let lineElem = document.getElementById("line-" + getLineId(switchLine));
- if (lineElem != null) {
- lineElem.scrollIntoView({block: "nearest"});
- }
console.log("arrow-up", this.getFocusedLine(), "=>", switchLine);
}
@@ -995,6 +991,9 @@ class Model {
this.updateCmd(lineMsg.cmd);
}
}
+ else if ("cmd" in update) {
+ this.updateCmd(update.cmd);
+ }
if ("window" in update) {
let winMsg : WindowUpdateType = update;
this.updateWindow(winMsg.window, false);
diff --git a/src/sh2.less b/src/sh2.less
index 88a0d781..321b4046 100644
--- a/src/sh2.less
+++ b/src/sh2.less
@@ -313,6 +313,7 @@ html, body, #main {
.line.line-cmd {
flex-direction: column;
+ scroll-margin-bottom: 20px;
.avatar {
cursor: pointer;
@@ -343,10 +344,7 @@ html, body, #main {
align-self: flex-start;
&.focus {
- /* box-shadow: -8px 0 12px -5px #aaa; */
- /* box-shadow: 0 0 0 4px hsl(0, 0%, 20%);*/
- /* filter:drop-shadow(3px 3px 10px #555); */
- box-shadow: 0 0 4px 4px rgba(255, 255, 255, 0.3);
+ box-shadow: 0 0 3px 3px rgba(255, 255, 255, 0.3);
}
}
}
@@ -470,6 +468,33 @@ html, body, #main {
body .xterm .xterm-viewport {
overflow-y: auto;
+ width: calc(100% + 5px);
+}
+
+.terminal-wrapper {
+ position: relative;
+
+ .term-block {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: transparent;
+ z-index: 10;
+ /* background-color: rgba(50, 50, 240, 0.05); */
+ }
+}
+
+.terminal-wrapper.focus .xterm {
+ .xterm-screen {
+ overflow-y: scroll;
+ overscroll-behavior: contain;
+ }
+
+ .xterm-viewport {
+ overscroll-behavior: contain;
+ }
}
.cmd-input-info, .xterm-viewport {
@@ -489,7 +514,7 @@ body .xterm .xterm-viewport {
}
.lines {
- background-color: black;
+ /* background-color: rgba(50, 50, 240, 0.05); */
display: flex;
flex-direction: column;
height: 80vh;
diff --git a/src/term.ts b/src/term.ts
index 3240606c..92e75bd2 100644
--- a/src/term.ts
+++ b/src/term.ts
@@ -64,7 +64,7 @@ class TermWrap {
this.usedRows = mobx.observable.box(termOpts.rows);
}
let cols = termOpts.cols;
- let maxCols = Math.trunc((winSize.width - 25) / DefaultCellWidth);
+ let maxCols = Math.trunc((winSize.width - 25) / DefaultCellWidth) - 1;
if (maxCols > cols) {
cols = maxCols;
}
@@ -105,6 +105,12 @@ class TermWrap {
mobx.action(() => {
this.isFocused.set(focus);
})();
+ if (this.connectedElem != null) {
+ let lineElem = this.connectedElem.closest(".line");
+ if (lineElem != null) {
+ lineElem.scrollIntoView({behavior: "smooth", block: "nearest"});
+ }
+ }
}
getTermUsedRows() : number {
@@ -200,7 +206,6 @@ class TermWrap {
this.dataUpdates.push({data: data, pos: pos});
return;
}
- console.log("pty-update", this.cmdId, this.ptyPos, data.length);
if (pos > this.ptyPos) {
throw new Error(sprintf("invalid pty-update, data-pos[%d] does not match term-pos[%d] cmdid[%s]", pos, this.ptyPos, this.cmdId));
}