From d5a5a9ce70aae0301463b5062e2e8146e407d142 Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 11 Aug 2022 10:22:43 -0700 Subject: [PATCH] better directory vs file completion --- src/main.tsx | 25 ++++++++++++++++++------- src/model.ts | 9 +++++---- src/sh2.less | 4 ++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index fb3ea7f9..3e9a8247 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -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} - 0}> -
- -
- {istr} + 0}> +
+ +
+ {this.getAfterSlash(istr)}
- -
+ +
...
diff --git a/src/model.ts b/src/model.ts index 0135a0c0..2e34e277 100644 --- a/src/model.ts +++ b/src/model.ts @@ -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 = { diff --git a/src/sh2.less b/src/sh2.less index 7ae70f9e..f67fbc1c 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -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; }