Continuing hook refactor

This commit is contained in:
Krzosa Karol
2026-01-09 23:07:47 +01:00
parent 0dd4641044
commit 507bd57854
3 changed files with 9 additions and 17 deletions

View File

@@ -1609,7 +1609,6 @@ void CMD_SearchProject(HookParam param) {
Buffer *search_project_buffer = GetBuffer(SearchProjectBufferID);
View *view = WindowOpenBufferView(main.window, search_project_buffer->name);
view->special = true;
view->kind = ViewKind_ActiveSearch;
AddCommand(&view->hooks, "Open", "ctrl-q | enter | f12", [](HookParam param) {
BSet active = GetBSet(ActiveWindowID);
BSet main = GetBSet(PrimaryWindowID);

View File

@@ -64,22 +64,23 @@ enum HookKind {
HookKind_AppUpdate,
HookKind_AppQuit,
// Should we have commands like PostCommand, PreCommand? what would be the purpose?
HookKind_Command,
HookKind_BeforeLayoutWindow,
HookKind_LayoutWindow,
HookKind_AfterLayoutWindow,
HookKind_BeforeRenderWindow,
HookKind_HandleRenderWindow,
HookKind_AfterRenderWindow,
// Currently we are only basically allowing control over non-layouted windows.
// How can this be expanded?
// - Changing the layout algorithm: this seems like a decent one
// - What beside that?
HookKind_LayoutWindow,
HookKind_RenderWindow
HookKind_BeforeBufferSave,
HookKind_HandleBufferSave,
HookKind_BufferSave,
HookKind_AfterBufferSave,
HookKind_BeforeBufferOpen,
HookKind_HandleBufferOpen,
HookKind_BufferOpen,
HookKind_AfterBufferOpen,
HookKind_ViewUpdate,
@@ -108,16 +109,9 @@ struct Hook {
struct Trigger *trigger;
};
enum ViewKind {
ViewKind_Normal,
ViewKind_FuzzySearch,
ViewKind_ActiveSearch,
};
struct View {
ViewID id;
BufferID active_buffer;
ViewKind kind;
Vec2I scroll;
Array<Caret> carets;

View File

@@ -209,7 +209,6 @@ void UpdateFuzzySearchView(HookParam param) {
}
void SetFuzzy(View *view) {
view->kind = ViewKind_FuzzySearch;
AddCommand(&view->hooks, "Open", "ctrl-q | enter | f12", [](HookParam){
BSet active = GetBSet(ActiveWindowID);
BSet main = GetBSet(PrimaryWindowID);