mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:17:45 +00:00
Shell: Tab completion for programs in PATH
This patch adds a function to LineEditor that takes the current shell buffer, searches PATH for the first program that starts with that buffer and then compares that to any other programs starting with the buffer to remove any mismatching characters off the end. The result is appended to the buffer. This may be faster with a data structure but that seems overkill.
This commit is contained in:
parent
4463adc0ff
commit
dccab569d2
2 changed files with 73 additions and 1 deletions
|
@ -1,7 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/CDirIterator.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
class LineEditor {
|
||||
public:
|
||||
|
@ -16,6 +19,7 @@ public:
|
|||
private:
|
||||
void clear_line();
|
||||
void append(const String&);
|
||||
void tab_complete_first_token();
|
||||
void vt_save_cursor();
|
||||
void vt_restore_cursor();
|
||||
void vt_clear_to_end_of_line();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue