mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-31 18:18:02 +01:00
show metacmd completions
This commit is contained in:
parent
e4bf68ca3b
commit
3aeab9d427
14
src/main.tsx
14
src/main.tsx
@ -328,6 +328,13 @@ class CmdInput extends React.Component<{}, {}> {
|
||||
lastHistoryUpDown : boolean = false;
|
||||
lastTabCurLine : mobx.IObservableValue<string> = mobx.observable.box(null);
|
||||
|
||||
componentDidMount() {
|
||||
let input = document.getElementById("main-cmd-input");
|
||||
if (input != null) {
|
||||
input.focus();
|
||||
}
|
||||
}
|
||||
|
||||
isModKeyPress(e : any) {
|
||||
return e.code.match(/^(Control|Meta|Alt|Shift)(Left|Right)$/);
|
||||
}
|
||||
@ -433,6 +440,9 @@ class CmdInput extends React.Component<{}, {}> {
|
||||
}
|
||||
|
||||
getAfterSlash(s : string) : string {
|
||||
if (s.startsWith("^/")) {
|
||||
return s.substr(1);
|
||||
}
|
||||
let slashIdx = s.lastIndexOf("/");
|
||||
if (slashIdx == s.length-1) {
|
||||
slashIdx = s.lastIndexOf("/", slashIdx-1);
|
||||
@ -489,14 +499,14 @@ class CmdInput extends React.Component<{}, {}> {
|
||||
<If condition={infoMsg && infoMsg.infolines != null}>
|
||||
<div className="info-lines">
|
||||
<For index="idx" each="line" of={infoMsg.infolines}>
|
||||
<div key={idx}>{line}</div>
|
||||
<div key={idx}>{line == "" ? " " : line}</div>
|
||||
</For>
|
||||
</div>
|
||||
</If>
|
||||
<If condition={infoMsg && infoMsg.infocomps != null && infoMsg.infocomps.length > 0}>
|
||||
<div className="info-comps">
|
||||
<For each="istr" index="istrIdx" of={infoMsg.infocomps}>
|
||||
<div key={istrIdx} className="info-comp">
|
||||
<div key={istrIdx} className={cn("info-comp", {"metacmd-comp": istr.startsWith("^")})}>
|
||||
{this.getAfterSlash(istr)}
|
||||
</div>
|
||||
</For>
|
||||
|
@ -571,6 +571,9 @@ body .xterm .xterm-viewport {
|
||||
.info-lines {
|
||||
color: #d3d7cf;
|
||||
font-size: 12px;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
white-space: pre;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.info-comps {
|
||||
@ -583,6 +586,10 @@ body .xterm .xterm-viewport {
|
||||
min-width: 200px;
|
||||
color: #d3d7cf;
|
||||
}
|
||||
|
||||
.metacmd-comp {
|
||||
color: #8ae234;
|
||||
}
|
||||
}
|
||||
|
||||
.info-error {
|
||||
|
Loading…
Reference in New Issue
Block a user