public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Jaben Carsey <jaben.carsey@intel.com>
Subject: [PATCH 2/6] ShellPkg: TAB logic incorrectly shows files in CWD when typing \<TAB>
Date: Mon,  8 Aug 2016 18:28:30 +0800	[thread overview]
Message-ID: <20160808102834.129372-3-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20160808102834.129372-1-ruiyu.ni@intel.com>

It should shows files in root directory of current map.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
---
 ShellPkg/Application/Shell/FileHandleWrappers.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c
index 5979d65..7db541f 100644
--- a/ShellPkg/Application/Shell/FileHandleWrappers.c
+++ b/ShellPkg/Application/Shell/FileHandleWrappers.c
@@ -368,13 +368,24 @@ CreateTabCompletionList (
 
   if (StrStr (InputString + TabPos, L":") == NULL) {
     //
-    // If file path doesn't contain ":", it's a path relative to current directory.
+    // If file path doesn't contain ":", ...
     //
     Cwd = ShellInfoObject.NewEfiShellProtocol->GetCurDir (NULL);
     if (Cwd != NULL) {
-      StrnCpyS (TabStr, (BufferSize) / sizeof (CHAR16), Cwd, (BufferSize) / sizeof (CHAR16) - 1);
       if (InputString[TabPos] != L'\\') {
+        //
+        // and it doesn't begin with "\\", it's a path relative to current directory.
+        // TabStr = "<cwd>\\"
+        //
+        StrnCpyS (TabStr, BufferSize / sizeof (CHAR16), Cwd, (BufferSize) / sizeof (CHAR16) - 1);
         StrCatS (TabStr, (BufferSize) / sizeof (CHAR16), L"\\");
+      } else {
+        //
+        // and it begins with "\\", it's a path pointing to root directory of current map.
+        // TabStr = "fsx:"
+        //
+        Index = StrStr (Cwd, L":") - Cwd + 1;
+        StrnCpyS (TabStr, BufferSize / sizeof (CHAR16), Cwd, Index);
       }
     }
   }
-- 
2.9.0.windows.1



  parent reply	other threads:[~2016-08-08 10:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 10:28 [PATCH 0/6] Fix shell TAB completion issue and bugs in LS command Ruiyu Ni
2016-08-08 10:28 ` [PATCH 1/6] ShellPkg: TAB logic incorrectly chops out fs0: when typing fs0:<TAB> Ruiyu Ni
2016-08-08 10:28 ` Ruiyu Ni [this message]
2016-08-08 10:28 ` [PATCH 3/6] ShellPkg: Fix FindFiles() to handle "fsx:EFI\BOOT" path Ruiyu Ni
2016-08-08 10:28 ` [PATCH 4/6] MdePkg: Enhance PathRemoveLastItem() to support "FS0:File.txt" Ruiyu Ni
2016-08-08 10:28 ` [PATCH 5/6] ShellPkg/ls: Fix to support "ls fs0:File.txt" Ruiyu Ni
2016-08-08 10:28 ` [PATCH 6/6] ShellPkg/ls: Display the correct directory path Ruiyu Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160808102834.129372-3-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox