Skip to content

Commit d7857ae

Browse files
committed
[WIP] Fix scrolling and resizing
Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 8b71aa1 commit d7857ae

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/webview/common/scrollbar.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
::-webkit-scrollbar {
3+
width: var(--vscode-text-width)
4+
}

src/webview/openshift-terminal/app/terminalInstance.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { FitAddon } from 'xterm-addon-fit';
1111
import { WebLinksAddon } from 'xterm-addon-web-links';
1212
import { WebglAddon } from 'xterm-addon-webgl';
1313
import 'xterm/css/xterm.css';
14+
import '../../common/scrollbar.scss';
1415

1516
/**
1617
* Represents a tab in the terminal view. Wraps an instance of xtermjs.
@@ -37,6 +38,8 @@ export const TerminalInstance = (props: {
3738
return newTerm;
3839
});
3940

41+
let resizeTimeout: NodeJS.Timeout = undefined;
42+
4043
const setXtermjsTheme = (fontFamily: string, fontSize: number) => {
4144
const computedStyle = window.getComputedStyle(document.body);
4245
const xtermjsTheme: ITheme = {
@@ -162,7 +165,7 @@ export const TerminalInstance = (props: {
162165
};
163166
}, []);
164167

165-
const handleResize = function (_e: UIEvent) {
168+
const performResize = function () {
166169
const dims = fitAddon.proposeDimensions();
167170
window.vscodeApi.postMessage({
168171
kind: 'resize',
@@ -172,6 +175,13 @@ export const TerminalInstance = (props: {
172175
},
173176
});
174177
fitAddon.fit();
178+
}
179+
180+
const handleResize = function (_e: UIEvent) {
181+
if (resizeTimeout) {
182+
clearTimeout(resizeTimeout);
183+
}
184+
resizeTimeout = setTimeout(performResize, 200);
175185
};
176186

177187
// resize the terminal when the window is resized
@@ -186,7 +196,7 @@ export const TerminalInstance = (props: {
186196
<Box marginY="8px" marginX="16px" width="100%" height="100%" overflow='scroll'>
187197
<div
188198
{...{ name: 'terminal-instance' }}
189-
style={{ width: '100%', height: '100%', display: 'flex', flexFlow: 'column' }}
199+
style={{ width: '100%', height: '100%', display: 'flex', flexFlow: 'column', overflow: 'hidden' }}
190200
ref={termRef}
191201
></div>
192202
</Box>

src/webview/openshift-terminal/app/terminalMultiplexer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export const TerminalMultiplexer = () => {
258258
</Box>
259259
{terminals.map((terminal, i) => (
260260
<TabPanel
261-
sx={{ margin: '0px', padding: '0px', flex: '1' }}
261+
sx={{ margin: '0px', padding: '0px', flex: '1', height: 'calc(100% - 36px)'}}
262262
value={`${i}`}
263263
key={terminal.terminal.props.uuid}
264264
>

0 commit comments

Comments
 (0)