mirror of https://github.com/adamdruppe/arsd.git
history search control externally
This commit is contained in:
parent
74f064f0bb
commit
dc68816960
21
terminal.d
21
terminal.d
|
@ -4875,7 +4875,7 @@ class LineGetter {
|
|||
it to `write` or `writeln`, you should return `["write", "writeln"]`.
|
||||
|
||||
If you offer different tab complete in different places, you still
|
||||
need to return the whole string. For example, a file competition of
|
||||
need to return the whole string. For example, a file completion of
|
||||
a second argument, when the user writes `terminal.d term<tab>` and you
|
||||
want it to complete to an additional `terminal.d`, you should return
|
||||
`["terminal.d terminal.d"]`; in other words, `candidate ~ completion`
|
||||
|
@ -6409,6 +6409,25 @@ class LineGetter {
|
|||
maybePositionCursor();
|
||||
}
|
||||
|
||||
bool isSearchingHistory() {
|
||||
return supplementalGetter !is null;
|
||||
}
|
||||
|
||||
/++
|
||||
Cancels an in-progress history search immediately, discarding the result, returning
|
||||
to the normal prompt.
|
||||
|
||||
If the user is not currently searching history (see [isSearchingHistory]), this
|
||||
function does nothing.
|
||||
+/
|
||||
void cancelHistorySearch() {
|
||||
if(isSearchingHistory()) {
|
||||
lastDrawLength = maximumDrawWidth - 1;
|
||||
supplementalGetter = null;
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
for integrating into another event loop
|
||||
you can pass individual events to this and
|
||||
|
|
Loading…
Reference in New Issue