summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorWilliam McPherson <willmcpherson2@gmail.com>2019-12-03 17:36:46 +1100
committerAndreas Kling <awesomekling@gmail.com>2019-12-05 17:09:22 +0100
commitaa8b40dce68eedaf1816ca9d1d1869c50c7bcab4 (patch)
treecc80da7646e7736f083bdf185a7618740b45e1b3 /AK
parent431abc8846263a78002d6b5869dc76e6acdcb72c (diff)
downloadserenity-aa8b40dce68eedaf1816ca9d1d1869c50c7bcab4.zip
Shell: Cache PATH for faster tab completion
This patch reduces the O(n) tab completion to something like O(log(n)). The cache is just a sorted vector of strings and we binary search it to get a string matching our input, and then check the surrounding strings to see if we need to remove any characters. Also we no longer stat each file every time. Also added an #include in BinarySearch since it was using size_t. Oops. If `export` is called, we recache. Need to implement the `hash` builtin for when an executable has been added to a directory in PATH.
Diffstat (limited to 'AK')
-rw-r--r--AK/BinarySearch.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/AK/BinarySearch.h b/AK/BinarySearch.h
index 16cd9784dc..c3f00ce04d 100644
--- a/AK/BinarySearch.h
+++ b/AK/BinarySearch.h
@@ -1,5 +1,7 @@
#pragma once
+#include <AK/Types.h>
+
namespace AK {
template<typename T>