fix height, and work on new style for cmdinput

This commit is contained in:
sawka 2023-10-11 18:55:20 -07:00
parent 3359ee7457
commit acc4eea74f
3 changed files with 15 additions and 5 deletions

View File

@ -89,15 +89,21 @@
textarea {
color: @term-bright-white;
background-color: transparent;
background-color: @textarea-background;
padding: 0.5em;
resize: none;
overflow: auto;
overflow-wrap: anywhere;
border-color: transparent;
border: none;
&.display-disabled {
background-color: #444;
}
&:focus {
box-shadow: none;
border: none;
}
}
input.history-input {

View File

@ -534,8 +534,11 @@ class TextAreaInput extends React.Component<{ onHeightChange: () => void }, {}>
if (activeScreen != null) {
activeScreen.focusType.get(); // for reaction
}
let computedInnerHeight = (displayLines + 1) * GlobalModel.termFontSize.get() + 4;
let computedOuterHeight = (displayLines + 2) * GlobalModel.termFontSize.get();
let termFontSize = GlobalModel.termFontSize.get();
// fontSize*1.5 (line-height) + 2 * 0.5em padding
let computedInnerHeight = displayLines * (termFontSize * 1.5) + 2 * 0.5 * termFontSize;
// inner height + 2*1em padding
let computedOuterHeight = computedInnerHeight + 2 * 1.0 * termFontSize;
return (
<div className="control is-expanded" ref={this.controlRef} style={{ height: computedOuterHeight }}>
<textarea
@ -547,11 +550,11 @@ class TextAreaInput extends React.Component<{ onHeightChange: () => void }, {}>
id="main-cmd-input"
onFocus={this.handleMainFocus}
onBlur={this.handleMainBlur}
style={{ height: computedInnerHeight, minHeight: computedInnerHeight }}
style={{ height: computedInnerHeight, minHeight: computedInnerHeight, fontSize: termFontSize }}
value={curLine}
onKeyDown={this.onKeyDown}
onChange={this.onChange}
className={cn("textarea glow", { "display-disabled": disabled })}
className={cn("textarea", { "display-disabled": disabled })}
></textarea>
<input
key="history"

View File

@ -15,6 +15,7 @@
@success-green: rgb(38, 97, 26);
@error-red: #cc0000;
@warning-yellow: #ffa500;
@textarea-background: #2a2a2a;
@term-black: #000000;
@term-red: #cc0000;