diff --git a/src/main.tsx b/src/main.tsx
index b39c346b..f24d5afb 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -370,7 +370,7 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
-
+
(loading)
@@ -882,7 +882,7 @@ class InfoRemoteShow extends React.Component<{}, {}> {
return (
<>
>
);
@@ -939,7 +939,7 @@ class InfoRemoteShow extends React.Component<{}, {}> {
input is only allowed while status is 'connecting'
-
+
>
);
diff --git a/src/sh2.less b/src/sh2.less
index 6ffdcf18..03eec8db 100644
--- a/src/sh2.less
+++ b/src/sh2.less
@@ -417,14 +417,18 @@ html, body, #main {
margin-right: 8px;
margin-top: 4px;
align-self: flex-start;
- overflow-y: hidden;
&.focus {
/* box-shadow: 0 0 3px 3px rgba(255, 255, 255, 0.3); */
}
- .terminal {
+ .terminal-connectelem {
overflow-y: hidden;
+ overflow-x: hidden;
+ }
+
+ .terminal {
+ margin-right: 8px; /* needed to show scrollbar */
}
}
}
@@ -629,7 +633,7 @@ body .xterm .xterm-viewport {
}
}
-.cmd-input-info, .xterm-viewport, .cmd-history {
+.cmd-input-info, .cmd-history {
&::-webkit-scrollbar {
background-color: #777;
width: 5px;
@@ -641,6 +645,30 @@ body .xterm .xterm-viewport {
}
}
+.terminal-wrapper.focus .xterm-viewport {
+ &::-webkit-scrollbar {
+ background-color: #777;
+ width: 5px;
+ height: 5px;
+ }
+
+ &::-webkit-scrollbar-thumb {
+ background: white;
+ }
+}
+
+.terminal-wrapper .xterm-viewport {
+ &::-webkit-scrollbar {
+ background-color: #222;
+ width: 5px;
+ height: 5px;
+ }
+
+ &::-webkit-scrollbar-thumb {
+ background: #555;
+ }
+}
+
.line.line-invalid {
color: #000;
margin-left: 5px;
diff --git a/src/term.ts b/src/term.ts
index 469d6cdb..a96aa44e 100644
--- a/src/term.ts
+++ b/src/term.ts
@@ -62,7 +62,10 @@ class TermWrap {
let cols = widthToCols(winSize.width);
this.termSize = {rows: termOpts.rows, cols: cols};
}
- this.terminal = new Terminal({rows: this.termSize.rows, cols: this.termSize.cols, fontSize: 12, fontFamily: "JetBrains Mono", theme: {foreground: "#d3d7cf"}});
+ let theme = {
+ foreground: "#d3d7cf",
+ };
+ this.terminal = new Terminal({rows: this.termSize.rows, cols: this.termSize.cols, fontSize: 12, fontFamily: "JetBrains Mono", theme: theme});
this.terminal._core._inputHandler._parser.setErrorHandler((state) => {
this.numParseErrors++;
return state;
@@ -84,9 +87,22 @@ class TermWrap {
this.focusHandler(false);
}
});
+ elem.addEventListener("scroll", this.elemScrollHandler);
this.reloadTerminal(0);
}
+ @boundMethod
+ elemScrollHandler(e : any) {
+ // this stops a weird behavior in the terminal
+ // xterm.js renders a textarea that handles focus. when it focuses and a space is typed the browser
+ // will scroll to make it visible (even though our terminal element has overflow hidden)
+ // this will undo that scroll.
+ if (e.target.scrollTop == 0) {
+ return;
+ }
+ e.target.scrollTop = 0;
+ }
+
getFontHeight() : number {
return this.terminal._core.viewport._currentRowHeight;
}
diff --git a/static/xterm.css b/static/xterm.css
index ab3965b4..e9fd8153 100644
--- a/static/xterm.css
+++ b/static/xterm.css
@@ -36,6 +36,7 @@
*/
.xterm {
+ cursor: text;
position: relative;
user-select: none;
-ms-user-select: none;
@@ -124,10 +125,6 @@
line-height: normal;
}
-.xterm {
- cursor: text;
-}
-
.xterm.enable-mouse-events {
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor: default;
@@ -166,9 +163,11 @@
opacity: 0.5;
}
-.xterm-underline {
- text-decoration: underline;
-}
+.xterm-underline-1 { text-decoration: underline; }
+.xterm-underline-2 { text-decoration: double underline; }
+.xterm-underline-3 { text-decoration: wavy underline; }
+.xterm-underline-4 { text-decoration: dotted underline; }
+.xterm-underline-5 { text-decoration: dashed underline; }
.xterm-strikethrough {
text-decoration: line-through;
@@ -178,3 +177,16 @@
z-index: 6;
position: absolute;
}
+
+.xterm-decoration-overview-ruler {
+ z-index: 7;
+ position: absolute;
+ top: 0;
+ right: 0;
+ pointer-events: none;
+}
+
+.xterm-decoration-top {
+ z-index: 2;
+ position: relative;
+}