better directory vs file completion

This commit is contained in:
sawka 2022-08-11 10:22:43 -07:00
parent 5082330dcf
commit d5a5a9ce70
3 changed files with 25 additions and 13 deletions

View File

@ -308,6 +308,17 @@ class CmdInput extends React.Component<{}, {}> {
GlobalModel.clearInfoMsg(true);
model.submitRawCommand(commandStr);
}
getAfterSlash(s : string) : string {
let slashIdx = s.lastIndexOf("/");
if (slashIdx == s.length-1) {
slashIdx = s.lastIndexOf("/", slashIdx-1);
}
if (slashIdx == -1) {
return s;
}
return s.substr(slashIdx+1);
}
render() {
let model = GlobalModel;
@ -343,15 +354,15 @@ class CmdInput extends React.Component<{}, {}> {
{infoMsg.infomsg}
</div>
</If>
<If condition={infoMsg && infoMsg.infostrings != null && infoMsg.infostrings.length > 0}>
<div className="info-strings">
<For each="istr" index="istrIdx" of={infoMsg.infostrings}>
<div key={istrIdx} className="info-string">
{istr}
<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">
{this.getAfterSlash(istr)}
</div>
</For>
<If condition={infoMsg.infostringsmore}>
<div key="more" className="info-string">
<If condition={infoMsg.infocompsmore}>
<div key="more" className="info-comp">
...
</div>
</If>

View File

@ -499,10 +499,11 @@ class Session {
}
type InfoType = {
infotitle : string;
infomsg : string;
infoerror : string;
infostrings : string[];
infotitle : string,
infomsg : string,
infoerror : string,
infocomps : string[],
infocompsmore : boolean,
};
type CmdLineUpdateType = {

View File

@ -513,13 +513,13 @@ body .xterm .xterm-viewport {
padding-bottom: 2px;
}
.info-strings {
.info-comps {
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding-bottom: 5px;
.info-string {
.info-comp {
min-width: 200px;
color: #d3d7cf;
}