void SearchWindowInit() {
    Window *window = CreateWind();
    SearchBarWindowID = window->id;
    Buffer *buffer = CreateBuffer(SysAllocator, "search_bar");
    SearchBufferID = buffer->id;
    View *view = CreateView(buffer->id);
    SearchViewID = view->id;
    window->active_view = view->id;
    window->draw_line_numbers = false;
    window->draw_scrollbar = false;
    window->draw_darker = true;
    window->draw_line_highlight = false;
    window->layout = false;
    window->visible = false;
    window->lose_focus_on_escape = true;
}

void SearchWindowLayout(Rect2I *rect, Int wx, Int wy) {
    Window *n = GetWindow(SearchBarWindowID);
    Rect2I copy_rect = *rect;
    if (!n->visible) {
        rect = &copy_rect;
    }
    Int barsize = GetExpandingBarSize(n);
    n->document_rect = n->total_rect = CutBottom(rect, barsize);
}

void Command_Search() {
    Window *window = GetWindow(SearchBarWindowID);
    window->visible = !window->visible;
} RegisterCommand(Command_Search, "ctrl-f");
