Skip to content

Commit d449454

Browse files
authored
fix shift part 2 (#12)
1 parent 73edddc commit d449454

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

apps/docs/src/app/globals.css

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,19 @@ button {
212212
}
213213

214214
.wterm {
215-
border: 1px solid #e5e5e5;
216-
box-shadow: none;
215+
box-shadow: inset 0 0 0 1px #e5e5e5;
217216
}
218217

219218
.wterm:focus-within {
220-
box-shadow: none;
219+
box-shadow: inset 0 0 0 1px #e5e5e5;
221220
}
222221

223222
.dark .wterm {
224-
border-color: #262626;
223+
box-shadow: inset 0 0 0 1px #262626;
224+
}
225+
226+
.dark .wterm:focus-within {
227+
box-shadow: inset 0 0 0 1px #262626;
225228
}
226229

227230
.wterm:not([class*="theme-"]) {
@@ -270,13 +273,11 @@ button {
270273

271274
.wterm.wterm-chat {
272275
--term-bg: var(--background);
273-
border: none;
274276
border-radius: 0;
275277
box-shadow: none;
276278
padding: 12px 16px;
277279
}
278280

279-
280281
.wterm.wterm-chat:focus,
281282
.wterm.wterm-chat:focus-visible,
282283
.wterm.wterm-chat:focus-within {

packages/@wterm/dom/src/terminal.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
--term-font-family: 'Menlo', 'Consolas', 'DejaVu Sans Mono', 'Courier New', monospace;
2424
--term-font-size: 14px;
2525
--term-line-height: 1.2;
26+
--term-row-height: 17px;
2627

2728
position: relative;
2829
background: var(--term-bg);
@@ -51,14 +52,14 @@
5152

5253
.term-row {
5354
display: block;
54-
height: calc(var(--term-font-size) * var(--term-line-height));
55+
height: var(--term-row-height);
5556
contain: content;
5657
}
5758

5859
.term-block {
5960
display: inline-block;
6061
width: 1ch;
61-
height: calc(var(--term-font-size) * var(--term-line-height));
62+
height: var(--term-row-height);
6263
vertical-align: top;
6364
overflow: hidden;
6465
}

packages/@wterm/dom/src/wterm.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,18 @@ export class WTerm {
174174
}
175175

176176
private _lockHeight(): void {
177-
const gridHeight = this._container.getBoundingClientRect().height;
178-
if (gridHeight > 0) {
179-
const cs = getComputedStyle(this.element);
180-
let extra =
181-
(parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0);
182-
if (cs.boxSizing === "border-box") {
183-
extra +=
184-
(parseFloat(cs.borderTopWidth) || 0) +
185-
(parseFloat(cs.borderBottomWidth) || 0);
186-
}
187-
this.element.style.maxHeight = `${gridHeight + extra}px`;
177+
const cs = getComputedStyle(this.element);
178+
const rowHeight =
179+
parseFloat(cs.getPropertyValue("--term-row-height")) || 17;
180+
const gridHeight = this.rows * rowHeight;
181+
let extra =
182+
(parseFloat(cs.paddingTop) || 0) + (parseFloat(cs.paddingBottom) || 0);
183+
if (cs.boxSizing === "border-box") {
184+
extra +=
185+
(parseFloat(cs.borderTopWidth) || 0) +
186+
(parseFloat(cs.borderBottomWidth) || 0);
188187
}
188+
this.element.style.height = `${gridHeight + extra}px`;
189189
}
190190

191191
private _measureCharSize(): { width: number; height: number } | null {

packages/@wterm/react/src/Terminal.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ const Terminal = forwardRef<TerminalHandle, TerminalProps>(function Terminal(
132132
const classes = ["wterm", themeClass, className].filter(Boolean).join(" ");
133133

134134
const mergedStyle: React.CSSProperties = {
135-
...(autoResize
136-
? undefined
137-
: { minHeight: Math.ceil(rows * 14 * 1.2 + 24) }),
135+
...(autoResize ? undefined : { height: rows * 17 + 24 }),
138136
...style,
139137
};
140138

0 commit comments

Comments
 (0)