Skip to content

Commit

Permalink
terminal/Terminal: work around xterm cursor style issue
Browse files Browse the repository at this point in the history
Since updating to Blueprintjs 5.x we can get aliasing artifacts on the
cursor due to bad rendering of box-shadow. This overrides it with
border instead.

xtermjs/xterm.js#4580
  • Loading branch information
dlech committed Jul 5, 2023
1 parent 5b5af67 commit 76345ea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/terminal/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ const Terminal: React.FunctionComponent = () => {
</audio>
<div className="pb-terminal-bell-overlay" ref={bellOverlayRef} />
<ResizeSensor targetRef={terminalRef} onResize={(): void => fitAddon.fit()}>
<div ref={terminalRef} className="h-100 pb-focus-managed" />
<div ref={terminalRef} className="h-100" />
</ResizeSensor>
</ContextMenu>
);
Expand Down
24 changes: 23 additions & 1 deletion src/terminal/terminal.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
// Copyright (c) 2022-2023 The Pybricks Authors

@use '@blueprintjs/core/lib/scss/variables' as bp;

Expand All @@ -17,3 +17,25 @@
transition: linear 100ms;
}
}

// HACK: work around https://github.com/xtermjs/xterm.js/issues/4580
.xterm-dom-renderer-owner-1 .xterm-rows .xterm-cursor.xterm-cursor-underline {
animation: pb-terminal-cursor 1s step-end infinite !important;
box-shadow: none !important;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom: 1px;
border-style: solid;
border-color: black;

.#{bp.$ns}-dark & {
border-color: white;
}
}

@keyframes pb-terminal-cursor {
50% {
border-style: hidden;
}
}

0 comments on commit 76345ea

Please sign in to comment.