Skip to content

Commit defddb8

Browse files
committed
[fzf] add support for initial search
1 parent 49cec58 commit defddb8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libs/fzf/src/fzf/Fzf.hx

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import fzf.WordNav;
1212

1313
typedef FzfOptions = {
1414
@:optional var prompt:String;
15+
@:optional var initialSearch:String;
1516
@:optional var geom:{width:Int, height:Int};
1617
}
1718

@@ -89,6 +90,12 @@ class Fzf {
8990
// TODO: find a way to have a proper _new_ tty
9091
if (options.geom == null) this.tty = Tty.init(Loop.defaultLoop(), File.stderr).resolve();
9192

93+
if (options.initialSearch ?? "" != "") {
94+
currentFilter = options.initialSearch;
95+
cursor = currentFilter.length;
96+
updateFilter();
97+
}
98+
9299
var esc = [];
93100
while (true) {
94101
redraw();

0 commit comments

Comments
 (0)