Directory fuzzy search and fix C: not opening
This commit is contained in:
@@ -41,10 +41,10 @@ Array<FuzzyPair> FuzzySearchLines(Allocator allocator, Buffer *buffer, Int line_
|
||||
return ratings;
|
||||
}
|
||||
|
||||
void CommandWindowUpdate() {
|
||||
void FuzzySearchViewUpdate() {
|
||||
ProfileFunction();
|
||||
BSet active = GetBSet(ActiveWindowID);
|
||||
if (active.window->id == CommandWindowID) {
|
||||
if (active.view->fuzzy) {
|
||||
Scratch scratch;
|
||||
String16 line_string = GetLineStringWithoutNL(active.buffer, 0);
|
||||
if (active.view->prev_search_line != line_string) {
|
||||
@@ -149,6 +149,7 @@ void Command_CommandWindowOpen() {
|
||||
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||
NextActiveWindowID = main.window->id;
|
||||
OpenCommand(active);
|
||||
SelectRange(main.view, Range{});
|
||||
}
|
||||
|
||||
void CommandWindowLayout(Rect2I *rect, Int wx, Int wy) {
|
||||
@@ -161,6 +162,11 @@ void CommandWindowLayout(Rect2I *rect, Int wx, Int wy) {
|
||||
n->document_rect = n->total_rect = CutBottom(rect, barsize);
|
||||
}
|
||||
|
||||
void SetFuzzy(View *view) {
|
||||
view->fuzzy = true;
|
||||
AddHook(&view->hooks, "Open", "ctrl-q | enter", Command_CommandWindowOpen);
|
||||
}
|
||||
|
||||
void CommandWindowInit() {
|
||||
Window *window = CreateWind();
|
||||
CommandWindowID = window->id;
|
||||
@@ -168,6 +174,7 @@ void CommandWindowInit() {
|
||||
buffer->special = true;
|
||||
View *view = CreateView(buffer->id);
|
||||
view->special = true;
|
||||
SetFuzzy(view);
|
||||
window->active_view = view->id;
|
||||
window->draw_line_numbers = false;
|
||||
window->draw_scrollbar = false;
|
||||
@@ -178,5 +185,4 @@ void CommandWindowInit() {
|
||||
window->sync_visibility_with_focus = true;
|
||||
window->lose_focus_on_escape = true;
|
||||
window->jump_history = false;
|
||||
AddHook(&view->hooks, "Open", "ctrl-q | enter", Command_CommandWindowOpen);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user