From ceaf05df49a74b9ac5f75f7cf75913134a5249df Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 7 Sep 2018 18:36:42 -0700 Subject: [PATCH] UI Quit events, search output target view, other bug reports --- 4coder_API/types.h | 3 + 4coder_default_framework.cpp | 47 ++++++++++++++++ 4coder_default_hooks.cpp | 3 +- 4coder_generated/app_functions.h | 6 +- 4coder_generated/command_metadata.h | 82 ++++++++++++++-------------- 4coder_lists.cpp | 2 - 4coder_search.cpp | 85 +++++++++++++++-------------- 4coder_ui_helper.cpp | 7 ++- 4ed_api_implementation.cpp | 32 +++++++++-- 4ed_view.h | 1 + todo.txt | 41 ++++++++++---- 11 files changed, 203 insertions(+), 106 deletions(-) diff --git a/4coder_API/types.h b/4coder_API/types.h index e826e131..1d85ecfc 100644 --- a/4coder_API/types.h +++ b/4coder_API/types.h @@ -762,6 +762,9 @@ STRUCT UI_Control{ i32_Rect bounding_box[UICoordinates_COUNT]; }; +TYPEDEF_FUNC void UI_Quit_Function_Type(struct Application_Links *app, View_Summary view); +#define UI_QUIT_FUNCTION(name) void name(struct Application_Links *app, View_Summary view) + /* DOC(Theme_Color stores a style tag/color pair, for the purpose of setting and getting colors in the theme.) DOC_SEE(Style_Tag) diff --git a/4coder_default_framework.cpp b/4coder_default_framework.cpp index a69db071..0918fec1 100644 --- a/4coder_default_framework.cpp +++ b/4coder_default_framework.cpp @@ -132,6 +132,15 @@ get_prev_view_looped_primary_panels(Application_Links *app, View_Summary *view_s return(view); } +static View_Summary +get_next_view_after_active(Application_Links *app, uint32_t access){ + View_Summary view = get_active_view(app, access); + if (view.exists){ + view = get_next_view_looped_primary_panels(app, &view, access); + } + return(view); +} + CUSTOM_COMMAND_SIG(change_active_panel) CUSTOM_DOC("Change the currently active panel, moving to the panel with the next highest view_id.") { @@ -172,6 +181,44 @@ CUSTOM_DOC("Create a new panel by horizontally splitting the active panel.") //////////////////////////////// +// NOTE(allen): Credits to nj/FlyingSolomon for authoring the original version of this helper. + +static Buffer_ID +create_or_switch_to_buffer_by_name(Application_Links *app, char *name, int32_t name_length, + View_Summary default_target_view){ + uint32_t access = AccessAll; + Buffer_Summary search_buffer = get_buffer_by_name(app, name, name_length, access); + + if (search_buffer.exists){ + View_Summary target_view = default_target_view; + + View_Summary view_with_buffer_already_open = get_first_view_with_buffer(app, search_buffer.buffer_id); + if (view_with_buffer_already_open.exists){ + target_view = view_with_buffer_already_open; + view_end_ui_mode(app, &target_view); + } + else{ + view_set_buffer(app, &target_view, search_buffer.buffer_id, 0); + } + set_active_view(app, &target_view); + + buffer_send_end_signal(app, &search_buffer); + buffer_replace_range(app, &search_buffer, 0, search_buffer.size, 0, 0); + } + else{ + search_buffer = create_buffer(app, name, name_length, BufferCreate_AlwaysNew); + buffer_set_setting(app, &search_buffer, BufferSetting_Unimportant, true); + buffer_set_setting(app, &search_buffer, BufferSetting_ReadOnly, true); + buffer_set_setting(app, &search_buffer, BufferSetting_WrapLine, false); + view_set_buffer(app, &default_target_view, search_buffer.buffer_id, 0); + set_active_view(app, &default_target_view); + } + + return(search_buffer.buffer_id); +} + +//////////////////////////////// + static void set_mouse_suppression(Application_Links *app, int32_t suppress){ if (suppress){ diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index be3c0f1c..661f6cc0 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -314,7 +314,8 @@ OPEN_FILE_HOOK_SIG(default_file_settings){ if (match(make_string(buffer.buffer_name, buffer.buffer_name_len), "*compilation*")){ wrap_lines = false; } - if (buffer.size >= (192 << 10)){ + //if (buffer.size >= (192 << 10)){ + if (buffer.size >= (128 << 10)){ wrap_lines = false; use_virtual_whitespace = false; } diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index ab1b5997..0ed1ca8a 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -47,7 +47,7 @@ struct Application_Links; #define VIEW_POST_FADE_SIG(n) bool32 n(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color) #define VIEW_START_UI_MODE_SIG(n) int32_t n(Application_Links *app, View_Summary *view) #define VIEW_END_UI_MODE_SIG(n) int32_t n(Application_Links *app, View_Summary *view) -#define VIEW_SET_UI_SIG(n) bool32 n(Application_Links *app, View_Summary *view, UI_Control *control) +#define VIEW_SET_UI_SIG(n) bool32 n(Application_Links *app, View_Summary *view, UI_Control *control, UI_Quit_Function_Type *quit_function) #define VIEW_GET_UI_COPY_SIG(n) UI_Control n(Application_Links *app, View_Summary *view, struct Partition *part) #define GET_GLOBAL_MANAGED_SCOPE_SIG(n) Managed_Scope n(Application_Links *app) #define GET_MANAGED_SCOPE_WITH_MULTIPLE_DEPENDENCIES_SIG(n) Managed_Scope n(Application_Links *app, Managed_Scope *intersected_scopes, int32_t count) @@ -585,7 +585,7 @@ static inline bool32 view_set_buffer(Application_Links *app, View_Summary *view, static inline bool32 view_post_fade(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color){return(app->view_post_fade(app, view, seconds, start, end, color));} static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *view){return(app->view_start_ui_mode(app, view));} static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode(app, view));} -static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui(app, view, control));} +static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control, UI_Quit_Function_Type *quit_function){return(app->view_set_ui(app, view, control, quit_function));} static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy(app, view, part));} static inline Managed_Scope get_global_managed_scope(Application_Links *app){return(app->get_global_managed_scope(app));} static inline Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *intersected_scopes, int32_t count){return(app->get_managed_scope_with_multiple_dependencies(app, intersected_scopes, count));} @@ -691,7 +691,7 @@ static inline bool32 view_set_buffer(Application_Links *app, View_Summary *view, static inline bool32 view_post_fade(Application_Links *app, View_Summary *view, float seconds, int32_t start, int32_t end, int_color color){return(app->view_post_fade_(app, view, seconds, start, end, color));} static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *view){return(app->view_start_ui_mode_(app, view));} static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode_(app, view));} -static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui_(app, view, control));} +static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control, UI_Quit_Function_Type *quit_function){return(app->view_set_ui_(app, view, control, quit_function));} static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy_(app, view, part));} static inline Managed_Scope get_global_managed_scope(Application_Links *app){return(app->get_global_managed_scope_(app));} static inline Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *intersected_scopes, int32_t count){return(app->get_managed_scope_with_multiple_dependencies_(app, intersected_scopes, count));} diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index ed932485..ead2199e 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -223,7 +223,7 @@ int32_t source_name_len; int32_t line_number; }; static Command_Metadata fcoder_metacmd_table[202] = { -{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 193 }, +{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 240 }, { PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 722 }, { PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 733 }, { PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 712 }, @@ -233,8 +233,8 @@ static Command_Metadata fcoder_metacmd_table[202] = { { PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 187 }, { PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 155 }, { PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 126 }, -{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 135 }, -{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 145 }, +{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 144 }, +{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 154 }, { PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 209 }, { PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 374 }, { PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 180 }, @@ -286,41 +286,41 @@ static Command_Metadata fcoder_metacmd_table[202] = { { PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 82 }, { PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 525 }, { PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 503 }, -{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 646 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 748 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 775 }, -{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 715 }, -{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 628 }, +{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 644 }, +{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 746 }, +{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 773 }, +{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 713 }, +{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 626 }, { PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1450 }, { PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 141 }, { PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 318 }, -{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 772 }, -{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 784 }, -{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 796 }, -{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 802 }, -{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 808 }, -{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 814 }, -{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 820 }, -{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 831 }, -{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 778 }, +{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 769 }, +{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 783 }, +{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 797 }, +{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 804 }, +{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 811 }, +{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 818 }, +{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 825 }, +{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 836 }, +{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 776 }, { PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\4coder_search.cpp", 29, 790 }, -{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 17 }, -{ PROC_LINKS(lister__backspace_text_field, 0), "lister__backspace_text_field", 28, "A lister mode command that dispatches to the lister's backspace text field handler.", 83, "w:\\4ed\\code\\4coder_lists.cpp", 28, 43 }, -{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 148 }, -{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "w:\\4ed\\code\\4coder_lists.cpp", 28, 220 }, -{ PROC_LINKS(lister__mouse_press, 0), "lister__mouse_press", 19, "A lister mode command that beings a click interaction with a list item under the mouse.", 87, "w:\\4ed\\code\\4coder_lists.cpp", 28, 88 }, -{ PROC_LINKS(lister__mouse_release, 0), "lister__mouse_release", 21, "A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 109, "w:\\4ed\\code\\4coder_lists.cpp", 28, 100 }, -{ PROC_LINKS(lister__move_down, 0), "lister__move_down", 17, "A lister mode command that dispatches to the lister's navigate down handler.", 76, "w:\\4ed\\code\\4coder_lists.cpp", 28, 63 }, -{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 179 }, -{ PROC_LINKS(lister__move_up, 0), "lister__move_up", 15, "A lister mode command that dispatches to the lister's navigate up handler.", 74, "w:\\4ed\\code\\4coder_lists.cpp", 28, 53 }, -{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 163 }, +{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 }, +{ PROC_LINKS(lister__backspace_text_field, 0), "lister__backspace_text_field", 28, "A lister mode command that dispatches to the lister's backspace text field handler.", 83, "w:\\4ed\\code\\4coder_lists.cpp", 28, 41 }, +{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 146 }, +{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "w:\\4ed\\code\\4coder_lists.cpp", 28, 218 }, +{ PROC_LINKS(lister__mouse_press, 0), "lister__mouse_press", 19, "A lister mode command that beings a click interaction with a list item under the mouse.", 87, "w:\\4ed\\code\\4coder_lists.cpp", 28, 86 }, +{ PROC_LINKS(lister__mouse_release, 0), "lister__mouse_release", 21, "A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 109, "w:\\4ed\\code\\4coder_lists.cpp", 28, 98 }, +{ PROC_LINKS(lister__move_down, 0), "lister__move_down", 17, "A lister mode command that dispatches to the lister's navigate down handler.", 76, "w:\\4ed\\code\\4coder_lists.cpp", 28, 61 }, +{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 177 }, +{ PROC_LINKS(lister__move_up, 0), "lister__move_up", 15, "A lister mode command that dispatches to the lister's navigate up handler.", 74, "w:\\4ed\\code\\4coder_lists.cpp", 28, 51 }, +{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 161 }, { PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 }, -{ PROC_LINKS(lister__repaint, 0), "lister__repaint", 15, "A lister mode command that updates the lists UI data.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 117 }, -{ PROC_LINKS(lister__wheel_scroll, 0), "lister__wheel_scroll", 20, "A lister mode command that scrolls the list in response to the mouse wheel.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 73 }, -{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 33 }, -{ PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 128 }, -{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 195 }, -{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 255 }, +{ PROC_LINKS(lister__repaint, 0), "lister__repaint", 15, "A lister mode command that updates the lists UI data.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 115 }, +{ PROC_LINKS(lister__wheel_scroll, 0), "lister__wheel_scroll", 20, "A lister mode command that scrolls the list in response to the mouse wheel.", 75, "w:\\4ed\\code\\4coder_lists.cpp", 28, 71 }, +{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 31 }, +{ PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 126 }, +{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 193 }, +{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 253 }, { PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1071 }, { PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1138 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 256 }, @@ -338,15 +338,15 @@ static Command_Metadata fcoder_metacmd_table[202] = { { PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 543 }, { PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1055 }, { PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1062 }, -{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 791 }, +{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 789 }, { PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1357 }, { PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1508 }, { PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 58 }, { PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 74 }, { PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 66 }, { PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1393 }, -{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 164 }, -{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 155 }, +{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 173 }, +{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 164 }, { PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 294 }, { PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 285 }, { PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 46 }, @@ -361,7 +361,7 @@ static Command_Metadata fcoder_metacmd_table[202] = { { PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 956 }, { PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1465 }, { PROC_LINKS(reload_themes, 0), "reload_themes", 13, "Loads all the theme files in the theme folder, replacing duplicates with the new theme data.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1485 }, -{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 213 }, +{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 260 }, { PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1096 }, { PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1471 }, { PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 816 }, @@ -404,19 +404,19 @@ static Command_Metadata fcoder_metacmd_table[202] = { { PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 456 }, { PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1259 }, { PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1265 }, -{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 187 }, +{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 234 }, { PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1417 }, { PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 354 }, { PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 334 }, { PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 484 }, -{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 205 }, +{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 252 }, { PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 493 }, -{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 199 }, +{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 246 }, { PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 560 }, { PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 549 }, { PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1459 }, { PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1407 }, -{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 851 }, +{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 856 }, { PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 745 }, { PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 106 }, { PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 39 }, diff --git a/4coder_lists.cpp b/4coder_lists.cpp index edeee29a..d1ac8e5f 100644 --- a/4coder_lists.cpp +++ b/4coder_lists.cpp @@ -9,8 +9,6 @@ CUSTOM_COMMAND_SIG(lister__quit) CUSTOM_DOC("A lister mode command that quits the list without executing any actions.") { View_Summary view = get_active_view(app, AccessAll); - Lister_State *state = view_get_lister_state(&view); - state->initialized = false; view_end_ui_mode(app, &view); } diff --git a/4coder_search.cpp b/4coder_search.cpp index aa82da81..e0885ebd 100644 --- a/4coder_search.cpp +++ b/4coder_search.cpp @@ -624,20 +624,13 @@ buffered_print_match_jump_line(Application_Links *app, Partition *part, Temp_Mem static void list__parameters(Application_Links *app, Heap *heap, Partition *scratch, - String *strings, int32_t count, Search_Range_Flag match_flags){ + String *strings, int32_t count, Search_Range_Flag match_flags, + View_Summary default_target_view){ // Open the search buffer String search_name = make_lit_string("*search*"); - Buffer_Summary search_buffer = get_buffer_by_name(app, search_name.str, search_name.size, AccessAll); - if (!search_buffer.exists){ - search_buffer = create_buffer(app, search_name.str, search_name.size, BufferCreate_AlwaysNew); - buffer_set_setting(app, &search_buffer, BufferSetting_Unimportant, true); - buffer_set_setting(app, &search_buffer, BufferSetting_ReadOnly, true); - buffer_set_setting(app, &search_buffer, BufferSetting_WrapLine, false); - } - else{ - buffer_send_end_signal(app, &search_buffer); - buffer_replace_range(app, &search_buffer, 0, search_buffer.size, 0, 0); - } + Buffer_ID search_buffer_id = create_or_switch_to_buffer_by_name(app, search_name.str, search_name.size, + default_target_view); + Buffer_Summary search_buffer = get_buffer(app, search_buffer_id, AccessAll); // Initialize a generic search all buffers Search_Set set = {0}; @@ -677,15 +670,14 @@ list__parameters(Application_Links *app, Heap *heap, Partition *scratch, buffered_print_flush(app, scratch, temp, &search_buffer); end_temp_memory(all_temp); - // Lock this *search* as the jump buffer - View_Summary view = get_active_view(app, AccessAll); - view_set_buffer(app, &view, search_buffer.buffer_id, 0); + // Lock *search* as the jump buffer lock_jump_buffer(search_name.str, search_name.size); } static void list_single__parameters(Application_Links *app, Heap *heap, Partition *scratch, - String str, bool32 substrings, bool32 case_insensitive){ + String str, bool32 substrings, bool32 case_insensitive, + View_Summary default_target_view){ Search_Range_Flag flags = 0; if (substrings){ flags |= SearchFlag_MatchSubstring; @@ -696,50 +688,54 @@ list_single__parameters(Application_Links *app, Heap *heap, Partition *scratch, if (case_insensitive){ flags |= SearchFlag_CaseInsensitive; } - list__parameters(app, heap, scratch, &str, 1, flags); + list__parameters(app, heap, scratch, &str, 1, flags, default_target_view); } static void list_query__parameters(Application_Links *app, Heap *heap, Partition *scratch, - bool32 substrings, bool32 case_insensitive){ + bool32 substrings, bool32 case_insensitive, + View_Summary default_target_view){ char space[1024]; String str = get_query_string(app, "List Locations For: ", space, sizeof(space)); if (str.size > 0){ - change_active_panel(app); - list_single__parameters(app, heap, scratch, str, substrings, case_insensitive); + list_single__parameters(app, heap, scratch, str, substrings, case_insensitive, + default_target_view); } } static void list_identifier__parameters(Application_Links *app, Heap *heap, Partition *scratch, - bool32 substrings, bool32 case_insensitive){ + bool32 substrings, bool32 case_insensitive, + View_Summary default_target_view){ View_Summary view = get_active_view(app, AccessProtected); Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); if (!buffer.exists) return; char space[512]; String str = get_token_or_word_under_pos(app, &buffer, view.cursor.pos, space, sizeof(space)); if (str.size > 0){ - change_active_panel(app); - list_single__parameters(app, heap, scratch, str, substrings, case_insensitive); + list_single__parameters(app, heap, scratch, str, substrings, case_insensitive, + default_target_view); } } static void list_selected_range__parameters(Application_Links *app, Heap *heap, Partition *scratch, - bool32 substrings, bool32 case_insensitive){ + bool32 substrings, bool32 case_insensitive, + View_Summary default_target_view){ View_Summary view = get_active_view(app, AccessProtected); Temp_Memory temp = begin_temp_memory(scratch); String str = get_string_in_view_range(app, scratch, &view); if (str.size > 0){ - change_active_panel(app); - list_single__parameters(app, heap, scratch, str, substrings, case_insensitive); + list_single__parameters(app, heap, scratch, str, substrings, case_insensitive, + default_target_view); } end_temp_memory(temp); } static void list_type_definition__parameters(Application_Links *app, Heap *heap, Partition *scratch, - String str){ + String str, + View_Summary default_target_view){ Temp_Memory temp = begin_temp_memory(scratch); String match_strings[9]; @@ -755,7 +751,8 @@ list_type_definition__parameters(Application_Links *app, Heap *heap, Partition * match_strings[i++] = build_string(scratch, "enum " , str, " {"); list__parameters(app, heap, scratch, - match_strings, ArrayCount(match_strings), 0); + match_strings, ArrayCount(match_strings), 0, + default_target_view); end_temp_memory(temp); @@ -772,49 +769,57 @@ list_type_definition__parameters(Application_Links *app, Heap *heap, Partition * CUSTOM_COMMAND_SIG(list_all_locations) CUSTOM_DOC("Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.") { - list_query__parameters(app, &global_heap, &global_part, false, false); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_query__parameters(app, &global_heap, &global_part, false, false, target_view); } CUSTOM_COMMAND_SIG(list_all_substring_locations) CUSTOM_DOC("Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.") { - list_query__parameters(app, &global_heap, &global_part, true, false); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_query__parameters(app, &global_heap, &global_part, true, false, target_view); } CUSTOM_COMMAND_SIG(list_all_locations_case_insensitive) CUSTOM_DOC("Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.") { - list_query__parameters(app, &global_heap, &global_part, false, true); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_query__parameters(app, &global_heap, &global_part, false, true, target_view); } CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive) CUSTOM_DOC("Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.") { - list_query__parameters(app, &global_heap, &global_part, true, true); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_query__parameters(app, &global_heap, &global_part, true, true, target_view); } CUSTOM_COMMAND_SIG(list_all_locations_of_identifier) CUSTOM_DOC("Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.") { - list_identifier__parameters(app, &global_heap, &global_part, false, false); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_identifier__parameters(app, &global_heap, &global_part, false, false, target_view); } CUSTOM_COMMAND_SIG(list_all_locations_of_identifier_case_insensitive) CUSTOM_DOC("Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.") { - list_identifier__parameters(app, &global_heap, &global_part, false, true); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_identifier__parameters(app, &global_heap, &global_part, false, true, target_view); } CUSTOM_COMMAND_SIG(list_all_locations_of_selection) CUSTOM_DOC("Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.") { - list_selected_range__parameters(app, &global_heap, &global_part, false, false); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_selected_range__parameters(app, &global_heap, &global_part, false, false, target_view); } CUSTOM_COMMAND_SIG(list_all_locations_of_selection_case_insensitive) CUSTOM_DOC("Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.") { - list_selected_range__parameters(app, &global_heap, &global_part, false, true); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_selected_range__parameters(app, &global_heap, &global_part, false, true, target_view); } CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition) @@ -823,8 +828,8 @@ CUSTOM_DOC("Queries user for string, lists all locations of strings that appear char space[1024]; String str = get_query_string(app, "List Definitions For: ", space, sizeof(space)); if (str.size > 0){ - change_active_panel(app); - list_type_definition__parameters(app, &global_heap, &global_part, str); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_type_definition__parameters(app, &global_heap, &global_part, str, target_view); } } @@ -836,8 +841,8 @@ CUSTOM_DOC("Reads a token or word under the cursor and lists all locations of st char space[512]; String str = get_token_or_word_under_pos(app, &buffer, view.cursor.pos, space, sizeof(space) - 1); if (str.size > 0){ - change_active_panel(app); - list_type_definition__parameters(app, &global_heap, &global_part, str); + View_Summary target_view = get_next_view_after_active(app, AccessAll); + list_type_definition__parameters(app, &global_heap, &global_part, str, target_view); } } diff --git a/4coder_ui_helper.cpp b/4coder_ui_helper.cpp index 7b80d717..d171b98a 100644 --- a/4coder_ui_helper.cpp +++ b/4coder_ui_helper.cpp @@ -209,6 +209,11 @@ init_lister_state(Lister_State *state, Heap *heap){ memset(&state->lister, 0, sizeof(state->lister)); } +UI_QUIT_FUNCTION(lister_quit_function){ + Lister_State *state = view_get_lister_state(&view); + state->initialized = false; +} + static UI_Item lister_get_clicked_item(Application_Links *app, View_Summary *view, Partition *scratch){ Temp_Memory temp = begin_temp_memory(scratch); @@ -350,7 +355,7 @@ lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view, } UI_Control control = ui_list_to_ui_control(scratch, &list); - view_set_ui(app, view, &control); + view_set_ui(app, view, &control, lister_quit_function); end_temp_memory(full_temp); } diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 52ee878c..1126a713 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -95,9 +95,25 @@ fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Live } } +inline void +fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Models *models){ + fill_view_summary(system, view, vptr, &models->live_set, &models->working_set); +} + inline void fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Command_Data *cmd){ - fill_view_summary(system, view, vptr, &cmd->models->live_set, &cmd->models->working_set); + fill_view_summary(system, view, vptr, cmd->models); +} + +internal void +view_quit_ui(System_Functions *system, Models *models, View *view){ + Assert(view != 0); + view->transient.ui_mode_counter = 0; + if (view->transient.ui_quit != 0){ + View_Summary view_summary = {0}; + fill_view_summary(system, &view_summary, view, models); + view->transient.ui_quit(&models->app_links, view_summary); + } } internal Editing_File* @@ -337,8 +353,7 @@ DOC_SEE(Command_Line_Interface_Flag) View *vptr = imp_get_view(cmd, view); if (vptr != 0){ view_set_file(system, models, vptr, file); - // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): - // Send "quit UI" events! + view_quit_ui(system, models, vptr); } } } @@ -2037,8 +2052,7 @@ DOC_SEE(Set_Buffer_Flag) if (file != vptr->transient.file_data.file){ view_set_file(system, models, vptr, file); if (!(flags & SetBuffer_KeepOriginalGUI)){ - // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): - // Send "quit UI" events! + view_quit_ui(system, models, vptr); } } } @@ -2100,6 +2114,11 @@ View_End_UI_Mode(Application_Links *app, View_Summary *view) vptr->transient.ui_mode_counter = clamp_bottom(0, vptr->transient.ui_mode_counter); if (vptr->transient.ui_mode_counter > 0){ vptr->transient.ui_mode_counter -= 1; + if (vptr->transient.ui_mode_counter == 0){ + System_Functions *system = cmd->system; + Models *models = cmd->models; + view_quit_ui(system, models, vptr); + } return(vptr->transient.ui_mode_counter); } else{ @@ -2112,7 +2131,7 @@ View_End_UI_Mode(Application_Links *app, View_Summary *view) } API_EXPORT bool32 -View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control) +View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control, UI_Quit_Function_Type *quit_function) { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -2201,6 +2220,7 @@ View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control) } memcpy(vptr->transient.ui_control.bounding_box, control->bounding_box, sizeof(control->bounding_box)); + vptr->transient.ui_quit = quit_function; return(true); } return(false); diff --git a/4ed_view.h b/4ed_view.h index fe2a6e47..7aeb657b 100644 --- a/4ed_view.h +++ b/4ed_view.h @@ -45,6 +45,7 @@ struct View_Transient{ File_Edit_Positions *edit_pos; i32 ui_mode_counter; + UI_Quit_Function_Type *ui_quit; UI_Control ui_control; GUI_Scroll_Vars ui_scroll; i32 ui_map_id; diff --git a/todo.txt b/todo.txt index cebcc166..2c957d38 100644 --- a/todo.txt +++ b/todo.txt @@ -7,7 +7,11 @@ [x] Managed Cooperative Memory API [x] Separate distinct buffer groups by newline [x] If no results put message explaining that fact (search buffer) + [x] Quit UI events + [] Change UI API to not be counted, toggle only for this build, no "UI stacks" + [] end file signal dumps the current managed scope [] Fixup File Lister Sorting + [] Exact Matches Sort to Top Always ALWAYS ALWAYS ALWAYS [] File System Lister Missing Status [] Command Lister [] Color Pallette Expansion For Keywords @@ -25,19 +29,22 @@ Bugs { - [x] Code Wrapping Problem - [x] Cancel Search Shouldn't Bring Up The Search Window - [x] Heap Corruption 1 - [x] Heap Corruption 2 - [x] New type matching pattern struct Name { /} - [] Reload "Big File" - [] crash after disabling virtual whitespace and reloading - [] If indent bug (get accompanying repro file) "mgl_base.h" - [] list_all_locations end UI mode - [] Lexing Scientific Notation " 3.402823466e+38F " + Repro Needed + { + } } - [] Documentation + Followup + { + [] If indent bug (get accompanying repro file) "mgl_base.h" (File size virtual whitespace situation) + [] Reload "Big File" + [] crash after disabling virtual whitespace and reloading + } + + Documentation + { + + } } Long Term @@ -56,5 +63,15 @@ Long Term { [] Remote Desktop Doesn't Work -> Need Renderer Modularity & Software Renderer [] Jim's file is blank even though it tries to load a real file (wtf) + [] Lexing Scientific Notation " 3.402823466e+38F " } -} \ No newline at end of file +} + +Change Log +{ + 4.0.29 + { + + } +} +