Skip to content

Commit 58b75eb

Browse files
committed
Update cursor size for multiline commands
1 parent 23d45d2 commit 58b75eb

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

client/modules/IDE/components/ConsoleInput.jsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class ConsoleInput extends React.Component {
5353
return false;
5454
}
5555

56-
// also need to set cursor position
5756
this.setState((state) => {
5857
const newCursor = Math.min(
5958
state.commandCursor + 1,
@@ -63,8 +62,7 @@ class ConsoleInput extends React.Component {
6362
.getDoc()
6463
.setValue(state.commandHistory[newCursor] || '');
6564
const cursorPos = this._cm.getDoc().getLine(0).length - 1;
66-
console.log(cursorPos);
67-
this._cm.setCursor({ line: 0, ch: cursorPos });
65+
this._cm.getDoc().setCursor({ line: 0, ch: cursorPos });
6866
return { commandCursor: newCursor };
6967
});
7068
} else if (e.key === 'ArrowDown') {
@@ -74,7 +72,6 @@ class ConsoleInput extends React.Component {
7472
return false;
7573
}
7674

77-
// also need to set cursor position
7875
this.setState((state) => {
7976
const newCursor = Math.max(state.commandCursor - 1, -1);
8077
this._cm
@@ -83,7 +80,7 @@ class ConsoleInput extends React.Component {
8380
const newLineCount = this._cm.getValue().split('\n').length;
8481
const newLine = this._cm.getDoc().getLine(newLineCount);
8582
const cursorPos = newLine ? newLine.length - 1 : 1;
86-
this._cm.setCursor({ line: lineCount, ch: cursorPos });
83+
this._cm.getDoc().setCursor({ line: lineCount, ch: cursorPos });
8784
return { commandCursor: newCursor };
8885
});
8986
}
@@ -108,12 +105,15 @@ class ConsoleInput extends React.Component {
108105
<div
109106
className="console__input"
110107
>
111-
<div className="console-active__arrow-container">
108+
<div
109+
className="console-active__arrow-container"
110+
style={{ height: `${this.props.fontSize * 1.3333}px` }}
111+
>
112112
<RightArrowIcon
113113
className="console-active__arrow"
114114
focusable="false"
115115
aria-hidden="true"
116-
style={{ width: `${this.props.fontSize}px` }}
116+
style={{ width: `${this.props.fontSize}px`, height: `${this.props.fontSize * 0.57}px` }}
117117
/>
118118
</div>
119119
<div ref={(element) => { this.codemirrorContainer = element; }} className="console__editor" />

client/styles/components/_console-input.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.console__input {
22
width: 100%;
33
display: flex;
4-
align-items: center;
4+
align-items: start;
55
@include themify() {
66
background-color: getThemifyVariable('console-input-background-color');
77
}

0 commit comments

Comments
 (0)