Continuing hook refactor
This commit is contained in:
@@ -1609,7 +1609,6 @@ void CMD_SearchProject(HookParam param) {
|
|||||||
Buffer *search_project_buffer = GetBuffer(SearchProjectBufferID);
|
Buffer *search_project_buffer = GetBuffer(SearchProjectBufferID);
|
||||||
View *view = WindowOpenBufferView(main.window, search_project_buffer->name);
|
View *view = WindowOpenBufferView(main.window, search_project_buffer->name);
|
||||||
view->special = true;
|
view->special = true;
|
||||||
view->kind = ViewKind_ActiveSearch;
|
|
||||||
AddCommand(&view->hooks, "Open", "ctrl-q | enter | f12", [](HookParam param) {
|
AddCommand(&view->hooks, "Open", "ctrl-q | enter | f12", [](HookParam param) {
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
BSet main = GetBSet(PrimaryWindowID);
|
BSet main = GetBSet(PrimaryWindowID);
|
||||||
|
|||||||
@@ -64,22 +64,23 @@ enum HookKind {
|
|||||||
HookKind_AppUpdate,
|
HookKind_AppUpdate,
|
||||||
HookKind_AppQuit,
|
HookKind_AppQuit,
|
||||||
|
|
||||||
|
// Should we have commands like PostCommand, PreCommand? what would be the purpose?
|
||||||
HookKind_Command,
|
HookKind_Command,
|
||||||
|
|
||||||
HookKind_BeforeLayoutWindow,
|
|
||||||
HookKind_LayoutWindow,
|
|
||||||
HookKind_AfterLayoutWindow,
|
|
||||||
|
|
||||||
HookKind_BeforeRenderWindow,
|
// Currently we are only basically allowing control over non-layouted windows.
|
||||||
HookKind_HandleRenderWindow,
|
// How can this be expanded?
|
||||||
HookKind_AfterRenderWindow,
|
// - Changing the layout algorithm: this seems like a decent one
|
||||||
|
// - What beside that?
|
||||||
|
HookKind_LayoutWindow,
|
||||||
|
HookKind_RenderWindow
|
||||||
|
|
||||||
HookKind_BeforeBufferSave,
|
HookKind_BeforeBufferSave,
|
||||||
HookKind_HandleBufferSave,
|
HookKind_BufferSave,
|
||||||
HookKind_AfterBufferSave,
|
HookKind_AfterBufferSave,
|
||||||
|
|
||||||
HookKind_BeforeBufferOpen,
|
HookKind_BeforeBufferOpen,
|
||||||
HookKind_HandleBufferOpen,
|
HookKind_BufferOpen,
|
||||||
HookKind_AfterBufferOpen,
|
HookKind_AfterBufferOpen,
|
||||||
|
|
||||||
HookKind_ViewUpdate,
|
HookKind_ViewUpdate,
|
||||||
@@ -108,16 +109,9 @@ struct Hook {
|
|||||||
struct Trigger *trigger;
|
struct Trigger *trigger;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ViewKind {
|
|
||||||
ViewKind_Normal,
|
|
||||||
ViewKind_FuzzySearch,
|
|
||||||
ViewKind_ActiveSearch,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct View {
|
struct View {
|
||||||
ViewID id;
|
ViewID id;
|
||||||
BufferID active_buffer;
|
BufferID active_buffer;
|
||||||
ViewKind kind;
|
|
||||||
Vec2I scroll;
|
Vec2I scroll;
|
||||||
Array<Caret> carets;
|
Array<Caret> carets;
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ void UpdateFuzzySearchView(HookParam param) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetFuzzy(View *view) {
|
void SetFuzzy(View *view) {
|
||||||
view->kind = ViewKind_FuzzySearch;
|
|
||||||
AddCommand(&view->hooks, "Open", "ctrl-q | enter | f12", [](HookParam){
|
AddCommand(&view->hooks, "Open", "ctrl-q | enter | f12", [](HookParam){
|
||||||
BSet active = GetBSet(ActiveWindowID);
|
BSet active = GetBSet(ActiveWindowID);
|
||||||
BSet main = GetBSet(PrimaryWindowID);
|
BSet main = GetBSet(PrimaryWindowID);
|
||||||
|
|||||||
Reference in New Issue
Block a user