From 1ca1dc1395af06c99e7ad4c13c73495439cc7e72 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 5 Oct 2018 18:42:56 -0700 Subject: [PATCH 1/2] Cleanup and bug fixes --- 4coder_API/types.h | 3 +- 4coder_config_grammar.txt | 2 +- 4coder_default_hooks.cpp | 30 ++- 4coder_generated/command_metadata.h | 252 ++++++++++---------- 4coder_generated/remapping.h | 28 +-- 4coder_lib/4cpp_default_keywords.h | 1 - 4coder_lib/4cpp_lexer_types.h | 1 - 4coder_scope_commands.cpp | 13 +- 4coder_seek.h | 3 - 4coder_ui_helper.cpp | 15 +- 4ed.cpp | 1 + 4ed_api_implementation.cpp | 14 ++ 4ed_view.cpp | 5 +- README.txt | 1 - changes.txt | 1 - meta/4ed_metagen.cpp | 14 +- platform_linux/gen_linux_icon.c | 24 +- platform_linux/linux_release_compat.c | 8 +- site/source_material/binding_list.txt | 1 - site/source_material/docs.txt | 1 - site/source_material/feature_list.txt | 1 - site/source_material/home.txt | 1 - site/source_material/introduction.txt | 1 - site/source_material/lexer_introduction.txt | 1 - site/source_material/roadmap.txt | 1 - site/source_material/site_header.txt | 1 - site/source_material/tutorials.txt | 1 - todo.txt | 21 +- 28 files changed, 238 insertions(+), 208 deletions(-) diff --git a/4coder_API/types.h b/4coder_API/types.h index 0dc33841..8bff094e 100644 --- a/4coder_API/types.h +++ b/4coder_API/types.h @@ -1,4 +1,3 @@ - #if !defined(FCODER_TYPES_H) #define FCODER_TYPES_H @@ -188,6 +187,8 @@ ENUM(uint32_t, Buffer_Create_Flag){ BufferCreate_MustAttachToFile = 0x10, /* DOC(Indicates that when create_buffer searches for already existing buffers that match the name parameter, it should only search by buffer name, and that it should not attach a file to the buffer even if it can. Caution! Buffers that don't have attached files cannot be saved.) */ BufferCreate_NeverAttachToFile = 0x20, + /* DOC(Normally the new file hook is called on any created buffer. Passing this flag will prevent the new file hook from being called automatically by the core.) */ + BufferCreate_SuppressNewFileHook = 0x40, }; /* DOC(Buffer_Creation_Data is a struct used as a local handle for the creation of a buffer. ) diff --git a/4coder_config_grammar.txt b/4coder_config_grammar.txt index 77e99cc4..75de3159 100644 --- a/4coder_config_grammar.txt +++ b/4coder_config_grammar.txt @@ -1,4 +1,4 @@ -config := [version] {assignment} +sconfig := [version] {assignment} version := "version" "(" INTEGER ")" ";" assignment := lvalue "=" rvalue ";" diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index 5a658a38..074fdbf2 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -45,21 +45,35 @@ COMMAND_CALLER_HOOK(default_command_caller){ Managed_Scope scope = view_get_managed_scope(app, view.view_id); managed_variable_set(app, scope, view_next_rewrite_loc, 0); if (fcoder_mode == FCoderMode_NotepadLike){ - managed_variable_set(app, scope, view_snap_mark_to_cursor, true); + for (View_Summary view_it = get_view_first(app, AccessAll); + view_it.exists; + get_view_next(app, &view_it, AccessAll)){ + Managed_Scope scope_it = view_get_managed_scope(app, view_it.view_id); + managed_variable_set(app, scope_it, view_snap_mark_to_cursor, true); + } } + + //// exec_command(app, cmd); + //// + uint64_t next_rewrite = 0; managed_variable_get(app, scope, view_next_rewrite_loc, &next_rewrite); managed_variable_set(app, scope, view_rewrite_loc, next_rewrite); if (fcoder_mode == FCoderMode_NotepadLike){ - uint64_t val = 0; - if (managed_variable_get(app, scope, view_snap_mark_to_cursor, &val)){ - if (val != 0){ - view = get_view(app, view.view_id, AccessAll); - view_set_mark(app, &view, seek_pos(view.cursor.pos)); + for (View_Summary view_it = get_view_first(app, AccessAll); + view_it.exists; + get_view_next(app, &view_it, AccessAll)){ + Managed_Scope scope_it = view_get_managed_scope(app, view_it.view_id); + uint64_t val = 0; + if (managed_variable_get(app, scope_it, view_snap_mark_to_cursor, &val)){ + if (val != 0){ + view_set_mark(app, &view_it, seek_pos(view_it.cursor.pos)); + } } } } + return(0); } @@ -318,7 +332,7 @@ RENDER_CALLER_SIG(default_render_caller){ } // NOTE(allen): Line highlight setup - if (highlight_line_at_cursor){ + if (highlight_line_at_cursor && is_active_view){ Theme_Color color = {0}; color.tag = Stag_Highlight_Cursor_Line; get_theme_colors(app, &color, 1); @@ -690,9 +704,11 @@ OPEN_FILE_HOOK_SIG(default_file_settings){ } OPEN_FILE_HOOK_SIG(default_new_file){ +#if 0 Buffer_Summary buffer = get_buffer(app, buffer_id, AccessOpen); char str[] = "/*\nNew File\n*/\n\n\n"; buffer_replace_range(app, &buffer, 0, 0, str, sizeof(str)-1); +#endif // no meaning for return return(0); diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 37a240c7..b15a203e 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -68,9 +68,6 @@ CUSTOM_COMMAND_SIG(goto_prev_jump_no_skips_sticky); CUSTOM_COMMAND_SIG(goto_prev_jump_sticky); CUSTOM_COMMAND_SIG(hide_filebar); CUSTOM_COMMAND_SIG(hide_scrollbar); -CUSTOM_COMMAND_SIG(highlight_next_scope_absolute); -CUSTOM_COMMAND_SIG(highlight_prev_scope_absolute); -CUSTOM_COMMAND_SIG(highlight_surrounding_scope); CUSTOM_COMMAND_SIG(if0_off); CUSTOM_COMMAND_SIG(increase_face_size); CUSTOM_COMMAND_SIG(increase_line_wrap); @@ -185,6 +182,9 @@ CUSTOM_COMMAND_SIG(seek_whitespace_right); CUSTOM_COMMAND_SIG(seek_whitespace_up); CUSTOM_COMMAND_SIG(seek_whitespace_up_end_line); CUSTOM_COMMAND_SIG(select_all); +CUSTOM_COMMAND_SIG(select_next_scope_absolute); +CUSTOM_COMMAND_SIG(select_prev_scope_absolute); +CUSTOM_COMMAND_SIG(select_surrounding_scope); CUSTOM_COMMAND_SIG(set_bindings_choose); CUSTOM_COMMAND_SIG(set_bindings_default); CUSTOM_COMMAND_SIG(set_bindings_mac_default); @@ -265,7 +265,7 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 577 }, { PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 554 }, { PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 56 }, -{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 523 }, +{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 526 }, { PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1123 }, { PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1373 }, { PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 109 }, @@ -296,9 +296,6 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 487 }, { PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 517 }, { PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 503 }, -{ PROC_LINKS(highlight_next_scope_absolute, 0), "highlight_next_scope_absolute", 29, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 400 }, -{ PROC_LINKS(highlight_prev_scope_absolute, 0), "highlight_prev_scope_absolute", 29, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 419 }, -{ PROC_LINKS(highlight_surrounding_scope, 0), "highlight_surrounding_scope", 27, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 385 }, { 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, 81 }, { 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, 565 }, { 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, 543 }, @@ -373,7 +370,7 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 134 }, { PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 85 }, { PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 141 }, -{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 517 }, +{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 520 }, { PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1529 }, { PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1090 }, { PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1115 }, @@ -391,7 +388,7 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1570 }, { PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1093 }, { PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1149 }, -{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 774 }, +{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 777 }, { PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 852 }, { PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 866 }, { PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1238 }, @@ -413,6 +410,9 @@ static Command_Metadata fcoder_metacmd_table[216] = { { PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1091 }, { PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1155 }, { PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 362 }, +{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 401 }, +{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 421 }, +{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 385 }, { PROC_LINKS(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 47 }, { PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 61 }, { PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 75 }, @@ -513,123 +513,123 @@ static int32_t fcoder_metacmd_ID_goto_prev_jump_no_skips_sticky = 55; static int32_t fcoder_metacmd_ID_goto_prev_jump_sticky = 56; static int32_t fcoder_metacmd_ID_hide_filebar = 57; static int32_t fcoder_metacmd_ID_hide_scrollbar = 58; -static int32_t fcoder_metacmd_ID_highlight_next_scope_absolute = 59; -static int32_t fcoder_metacmd_ID_highlight_prev_scope_absolute = 60; -static int32_t fcoder_metacmd_ID_highlight_surrounding_scope = 61; -static int32_t fcoder_metacmd_ID_if0_off = 62; -static int32_t fcoder_metacmd_ID_increase_face_size = 63; -static int32_t fcoder_metacmd_ID_increase_line_wrap = 64; -static int32_t fcoder_metacmd_ID_interactive_kill_buffer = 65; -static int32_t fcoder_metacmd_ID_interactive_new = 66; -static int32_t fcoder_metacmd_ID_interactive_open = 67; -static int32_t fcoder_metacmd_ID_interactive_open_or_new = 68; -static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 69; -static int32_t fcoder_metacmd_ID_kill_buffer = 70; -static int32_t fcoder_metacmd_ID_left_adjust_view = 71; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 72; -static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 73; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 74; -static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 75; -static int32_t fcoder_metacmd_ID_list_all_locations = 76; -static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 77; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 78; -static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 79; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 80; -static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 81; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 82; -static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 83; -static int32_t fcoder_metacmd_ID_list_all_substring_locations = 84; -static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 85; -static int32_t fcoder_metacmd_ID_lister__activate = 86; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 87; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 88; -static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 89; -static int32_t fcoder_metacmd_ID_lister__mouse_press = 90; -static int32_t fcoder_metacmd_ID_lister__mouse_release = 91; -static int32_t fcoder_metacmd_ID_lister__move_down = 92; -static int32_t fcoder_metacmd_ID_lister__move_down__default = 93; -static int32_t fcoder_metacmd_ID_lister__move_up = 94; -static int32_t fcoder_metacmd_ID_lister__move_up__default = 95; -static int32_t fcoder_metacmd_ID_lister__quit = 96; -static int32_t fcoder_metacmd_ID_lister__repaint = 97; -static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 98; -static int32_t fcoder_metacmd_ID_lister__write_character = 99; -static int32_t fcoder_metacmd_ID_lister__write_character__default = 100; -static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 101; -static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 102; -static int32_t fcoder_metacmd_ID_load_project = 103; -static int32_t fcoder_metacmd_ID_make_directory_query = 104; -static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 105; -static int32_t fcoder_metacmd_ID_move_down = 106; -static int32_t fcoder_metacmd_ID_move_down_10 = 107; -static int32_t fcoder_metacmd_ID_move_down_textual = 108; -static int32_t fcoder_metacmd_ID_move_left = 109; -static int32_t fcoder_metacmd_ID_move_line_down = 110; -static int32_t fcoder_metacmd_ID_move_line_up = 111; -static int32_t fcoder_metacmd_ID_move_right = 112; -static int32_t fcoder_metacmd_ID_move_up = 113; -static int32_t fcoder_metacmd_ID_move_up_10 = 114; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 115; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 116; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 117; -static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 118; -static int32_t fcoder_metacmd_ID_open_all_code = 119; -static int32_t fcoder_metacmd_ID_open_all_code_recursive = 120; -static int32_t fcoder_metacmd_ID_open_color_tweaker = 121; -static int32_t fcoder_metacmd_ID_open_file_in_quotes = 122; -static int32_t fcoder_metacmd_ID_open_in_other = 123; -static int32_t fcoder_metacmd_ID_open_long_braces = 124; -static int32_t fcoder_metacmd_ID_open_long_braces_break = 125; -static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 126; -static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 127; -static int32_t fcoder_metacmd_ID_open_panel_hsplit = 128; -static int32_t fcoder_metacmd_ID_open_panel_vsplit = 129; -static int32_t fcoder_metacmd_ID_page_down = 130; -static int32_t fcoder_metacmd_ID_page_up = 131; -static int32_t fcoder_metacmd_ID_paste = 132; -static int32_t fcoder_metacmd_ID_paste_and_indent = 133; -static int32_t fcoder_metacmd_ID_paste_next = 134; -static int32_t fcoder_metacmd_ID_paste_next_and_indent = 135; -static int32_t fcoder_metacmd_ID_place_in_scope = 136; -static int32_t fcoder_metacmd_ID_project_command_lister = 137; -static int32_t fcoder_metacmd_ID_project_fkey_command = 138; -static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 139; -static int32_t fcoder_metacmd_ID_query_replace = 140; -static int32_t fcoder_metacmd_ID_query_replace_identifier = 141; -static int32_t fcoder_metacmd_ID_query_replace_selection = 142; -static int32_t fcoder_metacmd_ID_redo = 143; -static int32_t fcoder_metacmd_ID_reload_themes = 144; -static int32_t fcoder_metacmd_ID_remap_interactive = 145; -static int32_t fcoder_metacmd_ID_rename_file_query = 146; -static int32_t fcoder_metacmd_ID_reopen = 147; -static int32_t fcoder_metacmd_ID_replace_in_range = 148; -static int32_t fcoder_metacmd_ID_reverse_search = 149; -static int32_t fcoder_metacmd_ID_reverse_search_identifier = 150; -static int32_t fcoder_metacmd_ID_save = 151; -static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 152; -static int32_t fcoder_metacmd_ID_save_to_query = 153; -static int32_t fcoder_metacmd_ID_scope_absorb_down = 154; -static int32_t fcoder_metacmd_ID_search = 155; -static int32_t fcoder_metacmd_ID_search_identifier = 156; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 157; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 158; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 159; -static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 160; -static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 161; -static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 162; -static int32_t fcoder_metacmd_ID_seek_end_of_line = 163; -static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 164; -static int32_t fcoder_metacmd_ID_seek_token_left = 165; -static int32_t fcoder_metacmd_ID_seek_token_right = 166; -static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 167; -static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 168; -static int32_t fcoder_metacmd_ID_seek_whitespace_down = 169; -static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 170; -static int32_t fcoder_metacmd_ID_seek_whitespace_left = 171; -static int32_t fcoder_metacmd_ID_seek_whitespace_right = 172; -static int32_t fcoder_metacmd_ID_seek_whitespace_up = 173; -static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 174; -static int32_t fcoder_metacmd_ID_select_all = 175; +static int32_t fcoder_metacmd_ID_if0_off = 59; +static int32_t fcoder_metacmd_ID_increase_face_size = 60; +static int32_t fcoder_metacmd_ID_increase_line_wrap = 61; +static int32_t fcoder_metacmd_ID_interactive_kill_buffer = 62; +static int32_t fcoder_metacmd_ID_interactive_new = 63; +static int32_t fcoder_metacmd_ID_interactive_open = 64; +static int32_t fcoder_metacmd_ID_interactive_open_or_new = 65; +static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 66; +static int32_t fcoder_metacmd_ID_kill_buffer = 67; +static int32_t fcoder_metacmd_ID_left_adjust_view = 68; +static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 69; +static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 70; +static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 71; +static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 72; +static int32_t fcoder_metacmd_ID_list_all_locations = 73; +static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 74; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 75; +static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 76; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 77; +static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 78; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 79; +static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 80; +static int32_t fcoder_metacmd_ID_list_all_substring_locations = 81; +static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 82; +static int32_t fcoder_metacmd_ID_lister__activate = 83; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 84; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 85; +static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 86; +static int32_t fcoder_metacmd_ID_lister__mouse_press = 87; +static int32_t fcoder_metacmd_ID_lister__mouse_release = 88; +static int32_t fcoder_metacmd_ID_lister__move_down = 89; +static int32_t fcoder_metacmd_ID_lister__move_down__default = 90; +static int32_t fcoder_metacmd_ID_lister__move_up = 91; +static int32_t fcoder_metacmd_ID_lister__move_up__default = 92; +static int32_t fcoder_metacmd_ID_lister__quit = 93; +static int32_t fcoder_metacmd_ID_lister__repaint = 94; +static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 95; +static int32_t fcoder_metacmd_ID_lister__write_character = 96; +static int32_t fcoder_metacmd_ID_lister__write_character__default = 97; +static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 98; +static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 99; +static int32_t fcoder_metacmd_ID_load_project = 100; +static int32_t fcoder_metacmd_ID_make_directory_query = 101; +static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 102; +static int32_t fcoder_metacmd_ID_move_down = 103; +static int32_t fcoder_metacmd_ID_move_down_10 = 104; +static int32_t fcoder_metacmd_ID_move_down_textual = 105; +static int32_t fcoder_metacmd_ID_move_left = 106; +static int32_t fcoder_metacmd_ID_move_line_down = 107; +static int32_t fcoder_metacmd_ID_move_line_up = 108; +static int32_t fcoder_metacmd_ID_move_right = 109; +static int32_t fcoder_metacmd_ID_move_up = 110; +static int32_t fcoder_metacmd_ID_move_up_10 = 111; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 112; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 113; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 114; +static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 115; +static int32_t fcoder_metacmd_ID_open_all_code = 116; +static int32_t fcoder_metacmd_ID_open_all_code_recursive = 117; +static int32_t fcoder_metacmd_ID_open_color_tweaker = 118; +static int32_t fcoder_metacmd_ID_open_file_in_quotes = 119; +static int32_t fcoder_metacmd_ID_open_in_other = 120; +static int32_t fcoder_metacmd_ID_open_long_braces = 121; +static int32_t fcoder_metacmd_ID_open_long_braces_break = 122; +static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 123; +static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 124; +static int32_t fcoder_metacmd_ID_open_panel_hsplit = 125; +static int32_t fcoder_metacmd_ID_open_panel_vsplit = 126; +static int32_t fcoder_metacmd_ID_page_down = 127; +static int32_t fcoder_metacmd_ID_page_up = 128; +static int32_t fcoder_metacmd_ID_paste = 129; +static int32_t fcoder_metacmd_ID_paste_and_indent = 130; +static int32_t fcoder_metacmd_ID_paste_next = 131; +static int32_t fcoder_metacmd_ID_paste_next_and_indent = 132; +static int32_t fcoder_metacmd_ID_place_in_scope = 133; +static int32_t fcoder_metacmd_ID_project_command_lister = 134; +static int32_t fcoder_metacmd_ID_project_fkey_command = 135; +static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 136; +static int32_t fcoder_metacmd_ID_query_replace = 137; +static int32_t fcoder_metacmd_ID_query_replace_identifier = 138; +static int32_t fcoder_metacmd_ID_query_replace_selection = 139; +static int32_t fcoder_metacmd_ID_redo = 140; +static int32_t fcoder_metacmd_ID_reload_themes = 141; +static int32_t fcoder_metacmd_ID_remap_interactive = 142; +static int32_t fcoder_metacmd_ID_rename_file_query = 143; +static int32_t fcoder_metacmd_ID_reopen = 144; +static int32_t fcoder_metacmd_ID_replace_in_range = 145; +static int32_t fcoder_metacmd_ID_reverse_search = 146; +static int32_t fcoder_metacmd_ID_reverse_search_identifier = 147; +static int32_t fcoder_metacmd_ID_save = 148; +static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 149; +static int32_t fcoder_metacmd_ID_save_to_query = 150; +static int32_t fcoder_metacmd_ID_scope_absorb_down = 151; +static int32_t fcoder_metacmd_ID_search = 152; +static int32_t fcoder_metacmd_ID_search_identifier = 153; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 154; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 155; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 156; +static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 157; +static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 158; +static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 159; +static int32_t fcoder_metacmd_ID_seek_end_of_line = 160; +static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 161; +static int32_t fcoder_metacmd_ID_seek_token_left = 162; +static int32_t fcoder_metacmd_ID_seek_token_right = 163; +static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 164; +static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 165; +static int32_t fcoder_metacmd_ID_seek_whitespace_down = 166; +static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 167; +static int32_t fcoder_metacmd_ID_seek_whitespace_left = 168; +static int32_t fcoder_metacmd_ID_seek_whitespace_right = 169; +static int32_t fcoder_metacmd_ID_seek_whitespace_up = 170; +static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 171; +static int32_t fcoder_metacmd_ID_select_all = 172; +static int32_t fcoder_metacmd_ID_select_next_scope_absolute = 173; +static int32_t fcoder_metacmd_ID_select_prev_scope_absolute = 174; +static int32_t fcoder_metacmd_ID_select_surrounding_scope = 175; static int32_t fcoder_metacmd_ID_set_bindings_choose = 176; static int32_t fcoder_metacmd_ID_set_bindings_default = 177; static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 178; diff --git a/4coder_generated/remapping.h b/4coder_generated/remapping.h index bd6af83c..16e8ff5b 100644 --- a/4coder_generated/remapping.h +++ b/4coder_generated/remapping.h @@ -142,9 +142,9 @@ bind(context, 'T', MDFR_ALT, list_all_locations_of_type_definition_of_identifier bind(context, '[', MDFR_CTRL, open_long_braces); bind(context, '{', MDFR_CTRL, open_long_braces_semicolon); bind(context, '}', MDFR_CTRL, open_long_braces_break); -bind(context, '[', MDFR_ALT, highlight_surrounding_scope); -bind(context, ']', MDFR_ALT, highlight_prev_scope_absolute); -bind(context, '\'', MDFR_ALT, highlight_next_scope_absolute); +bind(context, '[', MDFR_ALT, select_surrounding_scope); +bind(context, ']', MDFR_ALT, select_prev_scope_absolute); +bind(context, '\'', MDFR_ALT, select_next_scope_absolute); bind(context, '/', MDFR_ALT, place_in_scope); bind(context, '-', MDFR_ALT, delete_current_scope); bind(context, 'j', MDFR_ALT, scope_absorb_down); @@ -187,7 +187,7 @@ bind(context, 'n', MDFR_CTRL, goto_next_jump_sticky); bind(context, 'N', MDFR_CTRL, goto_prev_jump_sticky); bind(context, 'M', MDFR_CTRL, goto_first_jump_sticky); bind(context, 'm', MDFR_CTRL, build_in_build_panel); -bind(context, 'b', MDFR_ALT, toggle_filebar); +bind(context, 'b', MDFR_CTRL, toggle_filebar); bind(context, 'z', MDFR_CTRL, execute_any_cli); bind(context, 'Z', MDFR_CTRL, execute_previous_cli); bind(context, 'x', MDFR_CTRL, command_lister); @@ -312,9 +312,9 @@ bind(context, 'T', MDFR_CTRL, list_all_locations_of_type_definition_of_identifie bind(context, '[', MDFR_CMND, open_long_braces); bind(context, '{', MDFR_CMND, open_long_braces_semicolon); bind(context, '}', MDFR_CMND, open_long_braces_break); -bind(context, '[', MDFR_CTRL, highlight_surrounding_scope); -bind(context, ']', MDFR_CTRL, highlight_prev_scope_absolute); -bind(context, '\'', MDFR_CTRL, highlight_next_scope_absolute); +bind(context, '[', MDFR_CTRL, select_surrounding_scope); +bind(context, ']', MDFR_CTRL, select_prev_scope_absolute); +bind(context, '\'', MDFR_CTRL, select_next_scope_absolute); bind(context, '/', MDFR_CTRL, place_in_scope); bind(context, '-', MDFR_CTRL, delete_current_scope); bind(context, 'j', MDFR_CTRL, scope_absorb_down); @@ -514,9 +514,9 @@ static Meta_Key_Bind fcoder_binds_for_default_default_code_map[31] = { {0, 91, 1, "open_long_braces", 16, LINK_PROCS(open_long_braces)}, {0, 123, 1, "open_long_braces_semicolon", 26, LINK_PROCS(open_long_braces_semicolon)}, {0, 125, 1, "open_long_braces_break", 22, LINK_PROCS(open_long_braces_break)}, -{0, 91, 2, "highlight_surrounding_scope", 27, LINK_PROCS(highlight_surrounding_scope)}, -{0, 93, 2, "highlight_prev_scope_absolute", 29, LINK_PROCS(highlight_prev_scope_absolute)}, -{0, 39, 2, "highlight_next_scope_absolute", 29, LINK_PROCS(highlight_next_scope_absolute)}, +{0, 91, 2, "select_surrounding_scope", 24, LINK_PROCS(select_surrounding_scope)}, +{0, 93, 2, "select_prev_scope_absolute", 26, LINK_PROCS(select_prev_scope_absolute)}, +{0, 39, 2, "select_next_scope_absolute", 26, LINK_PROCS(select_next_scope_absolute)}, {0, 47, 2, "place_in_scope", 14, LINK_PROCS(place_in_scope)}, {0, 45, 2, "delete_current_scope", 20, LINK_PROCS(delete_current_scope)}, {0, 106, 2, "scope_absorb_down", 17, LINK_PROCS(scope_absorb_down)}, @@ -563,7 +563,7 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[38] = { {0, 78, 1, "goto_prev_jump_sticky", 21, LINK_PROCS(goto_prev_jump_sticky)}, {0, 77, 1, "goto_first_jump_sticky", 22, LINK_PROCS(goto_first_jump_sticky)}, {0, 109, 1, "build_in_build_panel", 20, LINK_PROCS(build_in_build_panel)}, -{0, 98, 2, "toggle_filebar", 14, LINK_PROCS(toggle_filebar)}, +{0, 98, 1, "toggle_filebar", 14, LINK_PROCS(toggle_filebar)}, {0, 122, 1, "execute_any_cli", 15, LINK_PROCS(execute_any_cli)}, {0, 90, 1, "execute_previous_cli", 20, LINK_PROCS(execute_previous_cli)}, {0, 120, 1, "command_lister", 14, LINK_PROCS(command_lister)}, @@ -687,9 +687,9 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[31] = { {0, 91, 4, "open_long_braces", 16, LINK_PROCS(open_long_braces)}, {0, 123, 4, "open_long_braces_semicolon", 26, LINK_PROCS(open_long_braces_semicolon)}, {0, 125, 4, "open_long_braces_break", 22, LINK_PROCS(open_long_braces_break)}, -{0, 91, 1, "highlight_surrounding_scope", 27, LINK_PROCS(highlight_surrounding_scope)}, -{0, 93, 1, "highlight_prev_scope_absolute", 29, LINK_PROCS(highlight_prev_scope_absolute)}, -{0, 39, 1, "highlight_next_scope_absolute", 29, LINK_PROCS(highlight_next_scope_absolute)}, +{0, 91, 1, "select_surrounding_scope", 24, LINK_PROCS(select_surrounding_scope)}, +{0, 93, 1, "select_prev_scope_absolute", 26, LINK_PROCS(select_prev_scope_absolute)}, +{0, 39, 1, "select_next_scope_absolute", 26, LINK_PROCS(select_next_scope_absolute)}, {0, 47, 1, "place_in_scope", 14, LINK_PROCS(place_in_scope)}, {0, 45, 1, "delete_current_scope", 20, LINK_PROCS(delete_current_scope)}, {0, 106, 1, "scope_absorb_down", 17, LINK_PROCS(scope_absorb_down)}, diff --git a/4coder_lib/4cpp_default_keywords.h b/4coder_lib/4cpp_default_keywords.h index 279f1bd2..370a1325 100644 --- a/4coder_lib/4cpp_default_keywords.h +++ b/4coder_lib/4cpp_default_keywords.h @@ -1,4 +1,3 @@ - // For a quick way to extend the default keywords: // #define FCPP_LEXER_EXTRA_KEYWORDS "my_keywords.h" // And in the file "my_keywords.h", list the keywords you want. diff --git a/4coder_lib/4cpp_lexer_types.h b/4coder_lib/4cpp_lexer_types.h index 2ec9fc36..ebfcc3d5 100644 --- a/4coder_lib/4cpp_lexer_types.h +++ b/4coder_lib/4cpp_lexer_types.h @@ -1,4 +1,3 @@ - // TOP #ifndef FCPP_LEXER_TYPES_INC diff --git a/4coder_scope_commands.cpp b/4coder_scope_commands.cpp index 876e6b2e..9e4ed659 100644 --- a/4coder_scope_commands.cpp +++ b/4coder_scope_commands.cpp @@ -382,7 +382,7 @@ view_set_to_region(Application_Links *app, View_Summary *view, int32_t major_pos } } -CUSTOM_COMMAND_SIG(highlight_surrounding_scope) +CUSTOM_COMMAND_SIG(select_surrounding_scope) CUSTOM_DOC("Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.") { uint32_t access = AccessProtected; @@ -394,10 +394,11 @@ CUSTOM_DOC("Finds the scope enclosed by '{' '}' surrounding the cursor and puts view_set_cursor(app, &view, seek_pos(range.first), true); view_set_mark(app, &view, seek_pos(range.end)); view_set_to_region(app, &view, range.first, range.end, scope_center_threshold); + no_mark_snap_to_cursor(app, view.view_id); } } -CUSTOM_COMMAND_SIG(highlight_next_scope_absolute) +CUSTOM_COMMAND_SIG(select_next_scope_absolute) CUSTOM_DOC("Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.") { uint32_t access = AccessProtected; @@ -412,11 +413,12 @@ CUSTOM_DOC("Finds the first scope started by '{' after the cursor and puts the c view_set_cursor(app, &view, seek_pos(top), true); view_set_mark(app, &view, seek_pos(bottom)); view_set_to_region(app, &view, top, bottom, scope_center_threshold); + no_mark_snap_to_cursor(app, view.view_id); } } } -CUSTOM_COMMAND_SIG(highlight_prev_scope_absolute) +CUSTOM_COMMAND_SIG(select_prev_scope_absolute) CUSTOM_DOC("Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.") { uint32_t access = AccessProtected; @@ -430,6 +432,7 @@ CUSTOM_DOC("Finds the first scope started by '{' before the cursor and puts the view_set_cursor(app, &view, seek_pos(top), true); view_set_mark(app, &view, seek_pos(bottom)); view_set_to_region(app, &view, top, bottom, scope_center_threshold); + no_mark_snap_to_cursor(app, view.view_id); } } } @@ -791,7 +794,7 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement Temp_Memory temp = begin_temp_memory(part); if (buffer_get_char(app, &buffer, top) == '{' && buffer_get_char(app, &buffer, bottom-1) == '}'){ - Range range; + Range range = {0}; if (find_whole_statement_down(app, &buffer, bottom, &range.start, &range.end)){ char *string_space = push_array(part, char, range.end - range.start); buffer_read_range(app, &buffer, range.start, range.end, string_space); @@ -842,6 +845,8 @@ CUSTOM_DOC("If a scope is currently selected, and a statement or block statement } } end_temp_memory(temp); + + no_mark_snap_to_cursor(app, view.view_id); } // BOTTOM diff --git a/4coder_seek.h b/4coder_seek.h index 75fe3e58..671dfb49 100644 --- a/4coder_seek.h +++ b/4coder_seek.h @@ -1,6 +1,3 @@ -/* -New File -*/ // TOP diff --git a/4coder_ui_helper.cpp b/4coder_ui_helper.cpp index 4d7e5e35..bcf90075 100644 --- a/4coder_ui_helper.cpp +++ b/4coder_ui_helper.cpp @@ -275,22 +275,23 @@ lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view, Lister_Node_Ptr_Array substring_matches = {0}; substring_matches.node_ptrs = push_array(scratch, Lister_Node*, node_count); + String key = state->lister.key_string; Absolutes absolutes = {0}; - get_absolutes(state->lister.key_string, &absolutes, true, true); + get_absolutes(key, &absolutes, true, true); + bool32 has_wildcard = (absolutes.count > 3); for (Lister_Node *node = state->lister.options.first; node != 0; node = node->next){ - if (state->lister.key_string.size == 0 || + if (key.size == 0 || wildcard_match_s(&absolutes, node->string, false)){ - bool32 has_wildcard = (absolutes.count > 2); - if (match_insensitive(node->string, state->lister.key_string) && exact_matches.count == 0){ + if (match_insensitive(node->string, key) && exact_matches.count == 0){ exact_matches.node_ptrs[exact_matches.count++] = node; } else if (!has_wildcard && - match_part_insensitive(node->string, state->lister.key_string) && - node->string.size > state->lister.key_string.size && - node->string.str[state->lister.key_string.size] == '.'){ + match_part_insensitive(node->string, key) && + node->string.size > key.size && + node->string.str[key.size] == '.'){ before_extension_matches.node_ptrs[before_extension_matches.count++] = node; } else{ diff --git a/4ed.cpp b/4ed.cpp index 09e4b11b..ae164bdd 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -153,6 +153,7 @@ file_cursor_to_end(System_Functions *system, Models *models, Editing_File *file) continue; } view_cursor_move(system, view, pos); + view->transient.edit_pos->mark = view->transient.edit_pos->cursor.pos; } } diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 49a12cca..0ebddf6b 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -1212,6 +1212,7 @@ DOC_SEE(Buffer_Create_Flag) Partition *part = &models->mem.part; Buffer_Summary result = {0}; + b32 buffer_is_for_new_file = false; if (filename_len > 0){ Temp_Memory temp = begin_temp_memory(part); @@ -1257,6 +1258,9 @@ DOC_SEE(Buffer_Create_Flag) } if (do_empty_buffer){ + if (has_canon_name){ + buffer_is_for_new_file = true; + } if ((flags & BufferCreate_NeverNew) == 0){ file = working_set_alloc_always(working_set, heap, &models->lifetime_allocator); if (file != 0){ @@ -1313,6 +1317,16 @@ DOC_SEE(Buffer_Create_Flag) i32 size = buffer_size(&file->state.buffer); if (size > 0){ edit_single(system, models, file, 0, size, 0, 0); + if (has_canon_name){ + buffer_is_for_new_file = true; + } + } + } + + if (file != 0 && buffer_is_for_new_file && + (flags & BufferCreate_SuppressNewFileHook) == 0){ + if (models->hook_new_file != 0){ + models->hook_new_file(&models->app_links, file->id.id); } } diff --git a/4ed_view.cpp b/4ed_view.cpp index 71410b12..1428b68c 100644 --- a/4ed_view.cpp +++ b/4ed_view.cpp @@ -1008,7 +1008,6 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v // NOTE(allen): Visual marker colors i32 marker_highlight_best_priority = min_i32; - b32 marker_highlight_is_set = false; u32 marker_highlight = 0; u32 marker_highlight_text = 0; @@ -1026,7 +1025,6 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v case VisualType_CharacterBlocks: { if (marker->priority > marker_highlight_best_priority){ - marker_highlight_is_set = true; marker_highlight = marker->color; marker_highlight_text = marker->text_color; marker_highlight_best_priority = marker->priority; @@ -1075,7 +1073,8 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v } for (;range_stack_top >= 0 && ind >= range_stack[range_stack_top].one_past_last; range_stack_top -= 1); - if (!marker_highlight_is_set && range_stack_top >= 0){ + if (range_stack_top >= 0 && + range_stack[range_stack_top].priority > marker_highlight_best_priority){ marker_highlight = range_stack[range_stack_top].color; marker_highlight_text = range_stack[range_stack_top].text_color; } diff --git a/README.txt b/README.txt index 7069ae78..ebc9b70a 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,3 @@ - Thank you for contributing to the 4coder project! To submit bug reports or to request particular features email: diff --git a/changes.txt b/changes.txt index 9b5cc96e..ffd874ea 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,3 @@ - New in alpha 4.0.28: -In config.4coder "eanble_virtual_whitespace" is now separate from "enable_code_wrapping" -In project.4coder .os = "all" now matches for all operating systems diff --git a/meta/4ed_metagen.cpp b/meta/4ed_metagen.cpp index 3daa2596..7ac15080 100644 --- a/meta/4ed_metagen.cpp +++ b/meta/4ed_metagen.cpp @@ -861,9 +861,9 @@ generate_remapping_code_and_data(){ bind(mappings, '{', MDFR_CTRL, open_long_braces_semicolon); bind(mappings, '}', MDFR_CTRL, open_long_braces_break); - bind(mappings, '[', MDFR_ALT, highlight_surrounding_scope); - bind(mappings, ']', MDFR_ALT, highlight_prev_scope_absolute); - bind(mappings, '\'', MDFR_ALT, highlight_next_scope_absolute); + bind(mappings, '[', MDFR_ALT, select_surrounding_scope); + bind(mappings, ']', MDFR_ALT, select_prev_scope_absolute); + bind(mappings, '\'', MDFR_ALT, select_next_scope_absolute); bind(mappings, '/', MDFR_ALT, place_in_scope); bind(mappings, '-', MDFR_ALT, delete_current_scope); bind(mappings, 'j', MDFR_ALT, scope_absorb_down); @@ -921,7 +921,7 @@ generate_remapping_code_and_data(){ bind(mappings, 'N', MDFR_CTRL, goto_prev_jump_sticky); bind(mappings, 'M', MDFR_CTRL, goto_first_jump_sticky); bind(mappings, 'm', MDFR_CTRL, build_in_build_panel); - bind(mappings, 'b', MDFR_ALT, toggle_filebar); + bind(mappings, 'b', MDFR_CTRL, toggle_filebar); bind(mappings, 'z', MDFR_CTRL, execute_any_cli); bind(mappings, 'Z', MDFR_CTRL, execute_previous_cli); @@ -1079,9 +1079,9 @@ generate_remapping_code_and_data(){ bind(mappings, '{', MDFR_CMND, open_long_braces_semicolon); bind(mappings, '}', MDFR_CMND, open_long_braces_break); - bind(mappings, '[', MDFR_CTRL, highlight_surrounding_scope); - bind(mappings, ']', MDFR_CTRL, highlight_prev_scope_absolute); - bind(mappings, '\'', MDFR_CTRL, highlight_next_scope_absolute); + bind(mappings, '[', MDFR_CTRL, select_surrounding_scope); + bind(mappings, ']', MDFR_CTRL, select_prev_scope_absolute); + bind(mappings, '\'', MDFR_CTRL, select_next_scope_absolute); bind(mappings, '/', MDFR_CTRL, place_in_scope); bind(mappings, '-', MDFR_CTRL, delete_current_scope); bind(mappings, 'j', MDFR_CTRL, scope_absorb_down); diff --git a/platform_linux/gen_linux_icon.c b/platform_linux/gen_linux_icon.c index 9da13e7c..71749d3c 100644 --- a/platform_linux/gen_linux_icon.c +++ b/platform_linux/gen_linux_icon.c @@ -13,36 +13,36 @@ #define OUTPUT_FILE "linux_icon.h" int main(void){ - + FILE* f = fopen(OUTPUT_FILE, "w"); - + fputs("/* Generated by gen_linux_icon.c */\n", f); - + int w = gimp_image.width, h = gimp_image.height; fprintf(f, "static const unsigned long linux_icon[] = {\n %d, %d,", w, h); - + const unsigned char* p = gimp_image.pixel_data; - + int i; for(i = 0; i < (w*h); ++i){ - + if((i % 6) == 0){ fputs("\n ", f); } - + unsigned int pixel = 0; - + pixel |= *p++ << 16L; pixel |= *p++ << 8L; pixel |= *p++; pixel |= *p++ << 24L; - + fprintf(f, " 0x%08x,", pixel); } - + fputs("\n};\n", f); - + fclose(f); - + puts("Generated linux icon in " OUTPUT_FILE); } diff --git a/platform_linux/linux_release_compat.c b/platform_linux/linux_release_compat.c index 5dafb8f4..3a126dca 100644 --- a/platform_linux/linux_release_compat.c +++ b/platform_linux/linux_release_compat.c @@ -5,8 +5,8 @@ // to run on older distros without glibc >= 2.14 extern "C" { -asm (".symver memcpy, memcpy@GLIBC_2.2.5"); -void *__wrap_memcpy(void *dest, const void *src, size_t n){ - return memcpy(dest, src, n); -} + asm (".symver memcpy, memcpy@GLIBC_2.2.5"); + void *__wrap_memcpy(void *dest, const void *src, size_t n){ + return memcpy(dest, src, n); + } } diff --git a/site/source_material/binding_list.txt b/site/source_material/binding_list.txt index 7dadc72d..e1e088c5 100644 --- a/site/source_material/binding_list.txt +++ b/site/source_material/binding_list.txt @@ -1,4 +1,3 @@ - \INCLUDE{site_header.txt} 4coder version \VERSION diff --git a/site/source_material/docs.txt b/site/source_material/docs.txt index 668efffc..1a14835a 100644 --- a/site/source_material/docs.txt +++ b/site/source_material/docs.txt @@ -1,4 +1,3 @@ - \INCLUDE{site_header.txt} \TABLE_OF_CONTENTS diff --git a/site/source_material/feature_list.txt b/site/source_material/feature_list.txt index 72939240..8f25e358 100644 --- a/site/source_material/feature_list.txt +++ b/site/source_material/feature_list.txt @@ -1,4 +1,3 @@ - \INCLUDE{site_header.txt} This page provides a list of 4coder features for anyone trying to determine whether 4coder is the right editor for them. To find a complete list of every default key binding visit \LINK{document:bindings} binding list \END. If a feature is missing here you should check out the \LINK{document:roadmap} roadmap \END page to see what is coming in the future. If the feature you want is on neither, it might be missing from this list, or it might actually be missing from 4coder, you should contact \STYLE{code} editor@4coder.net \END to ask questions and make requests. diff --git a/site/source_material/home.txt b/site/source_material/home.txt index e2bbb03b..e8d58a90 100644 --- a/site/source_material/home.txt +++ b/site/source_material/home.txt @@ -1,4 +1,3 @@ - \INCLUDE{site_header.txt} 4coder is a code editor that lives in a space between an IDE and a power editor such as Emacs or Vim. It targets maximum ease of customization, extension, and cross platform reliability. Earlier versions of 4coder focused entirely on C/C++ but it is now transitioning to be a more general purpose editor. Here you can learn about the features of 4coder, how to get started with 4coder, and how to get the absolute most out of 4coder. diff --git a/site/source_material/introduction.txt b/site/source_material/introduction.txt index c467d276..7bd7b98c 100644 --- a/site/source_material/introduction.txt +++ b/site/source_material/introduction.txt @@ -1,4 +1,3 @@ - This is the documentation for \VERSION. The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections. If you have questions or discover errors please contact \STYLE{code}editor@4coder.net\END or to get help from members of the 4coder and handmade network community you can post on the 4coder forums hosted at \STYLE{code}4coder.handmade.network\END. diff --git a/site/source_material/lexer_introduction.txt b/site/source_material/lexer_introduction.txt index e693ea18..e4415a42 100644 --- a/site/source_material/lexer_introduction.txt +++ b/site/source_material/lexer_introduction.txt @@ -1,4 +1,3 @@ - The 4cpp lexer system provides a polished, fast, flexible system that takes in C/C++ and outputs a tokenization of the text data. There are two API levels. One level is setup to let you easily get a tokenization of the file. This level manages memory for you with malloc to make it as fast as possible to start getting your tokens. The second level enables deep integration by allowing control over allocation, data chunking, and output rate control. To use the quick setup API you simply include 4cpp_lexer.h and read the documentation at \DOC_LINK{cpp_lex_file}. diff --git a/site/source_material/roadmap.txt b/site/source_material/roadmap.txt index c74a0cb6..2f793b56 100644 --- a/site/source_material/roadmap.txt +++ b/site/source_material/roadmap.txt @@ -1,4 +1,3 @@ - \INCLUDE{site_header.txt} Right now I am working on upgrading some core internal systems that should buy me the flexibility I need to get the rest of the envisioned features done. Because these core upgrades are experimental in nature, it's hard to predict how long it will take before they are ready. diff --git a/site/source_material/site_header.txt b/site/source_material/site_header.txt index 6ebd130d..6944b778 100644 --- a/site/source_material/site_header.txt +++ b/site/source_material/site_header.txt @@ -1,4 +1,3 @@ - \META_PARSE{custom_funcs}{4ed_api_implementation.cpp} \META_PARSE{custom_types}{4coder_API/types.h} \META_PARSE{string} {string/internal_4coder_string.cpp} diff --git a/site/source_material/tutorials.txt b/site/source_material/tutorials.txt index 6f938805..2d2af140 100644 --- a/site/source_material/tutorials.txt +++ b/site/source_material/tutorials.txt @@ -1,4 +1,3 @@ - \INCLUDE{site_header.txt} Getting started with 4coder and navigating your files: diff --git a/todo.txt b/todo.txt index 3ff546dd..048becb8 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,3 @@ - [] Build 4.0.29 { Features @@ -8,7 +7,12 @@ Bugs { - [] Before '.' name matches don't sort to the top like they're supposed to. + [x] Before '.' name matches don't sort to the top like they're supposed to. + [x] notepad like mode - select scope range snap shouldn't happen + [x] highlight high priority vs block low priority should win + [x] new files don't get their automatically inserted comments anymore + [x] nodepad like mode - when moving the cursor in a non-active view, there is no marker snap + [x] notepad like mode - can't tell which view is active, only highlight line in active view? Repro Needed { } @@ -40,10 +44,10 @@ [x] alloc_managed_memory_in_scope [x] alloc_buffer_markers_on_buffer [x] create_marker_visuals - [x] marker_visuals_set_look - [x] marker_visuals_set_take_rule - [x] marker_visuals_set_priority - [x] marker_visuals_set_view_key + [] marker_visuals_set_look + [] marker_visuals_set_take_rule + [] marker_visuals_set_priority + [] marker_visuals_set_view_key [] destroy_marker_visuals [] buffer_markers_get_attached_visuals_count [] buffer_markers_get_attached_visuals @@ -92,6 +96,11 @@ Bugs { [] Texture binding changes too often problem. + Repro Needed + { + [] pasting long comment at top of code files doesn't always parse right away??? + [] saving to removable media -> Ask person who sent it in for more info + } } } From d30be67d228361c725b3e84d7c4c5d2088d584d2 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 6 Oct 2018 08:26:20 -0700 Subject: [PATCH 2/2] set_command_input --- 4coder_API/types.h | 115 ++++++++++++++++++- 4coder_generated/app_functions.h | 7 ++ 4ed_api_implementation.cpp | 156 +++++++++++++++++++++++--- site/4ed_sitegen.cpp | 20 ---- site/source_material/binding_list.txt | 19 +--- string/internal_4coder_string.cpp | 14 ++- todo.txt | 126 ++++++++++----------- 7 files changed, 336 insertions(+), 121 deletions(-) diff --git a/4coder_API/types.h b/4coder_API/types.h index 8bff094e..673b6fd8 100644 --- a/4coder_API/types.h +++ b/4coder_API/types.h @@ -212,10 +212,16 @@ ENUM(uint32_t, Buffer_Kill_Flag){ BufferKill_AlwaysKill = 0x2, }; +/* DOC(A status enumeration returned by kill_buffer.) +DOC_SEE(kill_buffer) */ ENUM(int32_t, Buffer_Kill_Result){ + /* DOC(The buffer was successfully killed.) */ BufferKillResult_Killed = 0, + /* DOC(The buffer was not killed because it is dirty. This can be overriden with the flag BufferKill_AlwaysKill. This result is usually followed up by launching a "sure to kill" dialogue, but that is entirely optional.) */ BufferKillResult_Dirty = 1, + /* DOC(The buffer was not killed because it is unkillable. Unkillable buffers are the buffers that must be open for the core's purposes. *messages* and *scratch* are unkillable buffers.) */ BufferKillResult_Unkillable = 2, + /* DOC(The specified buffer does not exist.) */ BufferKillResult_DoesNotExist = 3, }; @@ -311,7 +317,8 @@ ENUM(int32_t, Mouse_Cursor_Show_Type){ MouseCursorShow_Never, /* DOC(The MouseCursorShow_Never mode always shows the cursor.) */ MouseCursorShow_Always, - // MouseCursorShow_WhenActive,// TODO(allen): coming soon + // TODO(allen): coming soon + // MouseCursorShow_WhenActive, }; /* DOC(A View_Split_Position specifies where a new view should be placed as a result of a view split operation.) */ @@ -382,7 +389,7 @@ STRUCT Mouse_State{ GLOBAL_VAR Mouse_State null_mouse_state = {0}; -/* DOC(Range describes an integer range typically used for ranges within a buffer. Ranges tend are usually not passed as a Range struct into the API, but this struct is used to return ranges. +/* DOC(Range describes an integer range typically used for ranges within a buffer. Ranges are not used to pass into the API, but this struct is used for returns. Throughout the API ranges are thought of in the form [min,max) where max is "one past the end" of the range that is actually read/edited/modified.) */ UNION Range{ @@ -406,8 +413,11 @@ UNION Range{ }; }; +/* DOC(An array of ranges. This is just a plain pointer bundled with a count, no additional special structure.) */ STRUCT Range_Array{ + /* DOC(A pointer to the array of ranges.) */ Range *ranges; + /* DOC(The number of ranges in the array.) */ int32_t count; }; @@ -680,55 +690,127 @@ STRUCT View_Summary{ GUI_Scroll_Vars scroll_vars; }; +/* DOC(The enumeration of types of managed objects.) */ ENUM(int32_t, Managed_Object_Type) { + /* DOC(This type value indicates that the specified object for an operation is not a valid managed object. +A handle for a managed object can "go bad" when it's scope is cleared, or when it is freed, so it is possible to store handles and check them for validity on use. However, all managed object APIs do the necessary checks on their parameters and return appropriate failure results on bad handles.) */ ManagedObjectType_Error = 0, + /* DOC(A memory object is used for straightforward memory allocation in a managed scope. These objects have no special cleanup, no extra operations, and their memory storage is never touched by the core.) */ ManagedObjectType_Memory = 1, + /* DOC(A marker object is used to place markers into buffers that move along with the text upon which they are placed. A marker object has a specific buffer to which it is attached, and must be allocated in a scope dependent upon the lifetime of that buffer. Marker objects always use the Marker type for their items, and their item size is always sizeof(Marker). When a marker object is freed, all of the marker visuals attached to it are also freed and the specific buffer of the object no longer adjusts the marker data when edits occur.) */ ManagedObjectType_Markers = 2, ManagedObjectType_COUNT = 3, }; +/* DOC(A handle to a managed scope. A managed scope contains variables and objects all of which can be freed and reset in optimized bulk operations. Many managed scopes are created and destroyed by the core to track the lifetime of entities like buffers and views. Because a managed scope contains it's own copy of the managed variables, managed scopes can also be used as a keying mechanism to store and retrieve special information related to entities like buffers and views.) */ TYPEDEF uint64_t Managed_Scope; + +/* DOC(An id refering to a managed variable. Managed variables are created globally, but each managed scope has it's own set of values for the managed variables. Managed variables are created via a unique string. Attempting to create a variable with the same name as an existing variable fails. When naming variables it is recommended that you place a 'module name' followed by a '.' and then a descriptive variable name to distinguish your variables from variables written by other 4coder users that might someday need to work together in the same configuration. Example: "MyUniqueCustomization.variable_name"). The variable's id is used to set and get the value from managed scopes. */ TYPEDEF int32_t Managed_Variable_ID; + +/* DOC(A handle to a managed object. Managed objects have various behaviors and special uses depending on their type. All managed objects share the property of being tied to a managed scope, so that they are cleaned up and freed when that scope's contents are cleared or when the scope is destroyed, they all support store and load operations, although not all with the exact same meanings and implications, and they can all be freed individually instead of with the entire scope.) */ TYPEDEF uint64_t Managed_Object; static Managed_Scope ManagedScope_NULL = 0; static Managed_Variable_ID ManagedVariableIndex_ERROR = -1; static Managed_Object ManagedObject_NULL = 0; +/* DOC(A multi-member identifier for a marker visual. A marker visual is attached to a marker object (Marker_Object), it is freed when the marker object is freed or when it is specifically destroyed. Multiple marker visuals can be placed on a single marker object.) +DOC_SEE(Marker_Visual_Type) +DOC_SEE(Marker_Visual_Symbolic_Color) +DOC_SEE(Marker_Visual_Text_Style) +DOC_SEE(Marker_Visual_Take_Rule) +DOC_SEE(Marker_Visual_Priority_Level) +*/ STRUCT Marker_Visual{ Managed_Scope scope; uint32_t slot_id; uint32_t gen_id; }; + +/* +DOC(The enumeration of visual effects that a marker visual can create. All effects have a color aspect and text_color aspect. The exact meaning of these aspects depends upon the effect's type. + +There are several effect styles, two effect styles never conflict with one another, each style can be applied to each character. If two effects of the same style are applied to the same character, then the effect with the higher priority is rendered, and the lower priority effect is ignored. The render order for effects is: + +Highlight Style + +Wire Frame Style + +I-Bar Style + +Some effects are character oriented, meaning they have an effect on the individual character/characters that the markers specify. Other effects are line oriented, meaning that they effect the entire line on which their markers are placed. Line oriented highlight style effects are always overriden by character oriented highlight style effects of the same style, regardless of relative priority levels. + +Single marked effects use each marker to specify a single point at which an effect is applied. Range marked effects take pairs of markers to specify a left inclusive right eclusive range to effect. + +In range marked effects, two conflicting effects with the same priority level are further resolved by prefering the effect with the higher-index starting position. This means that if range A completely contains range B and they have the same priority level, then range B will be visible, and range A will be visible wherever range B is not. +) +*/ ENUM(int32_t, Marker_Visual_Type) { + /* DOC(No visual effect, with this type it is as if the marker visual does not exist.) */ VisualType_Invisible = 0, + /* DOC(Shows a block around the background of each marked character. The color aspect determines the color of the block behind the characters, the text_color aspect determines the color of the characters. + +This is a character oriented highlight style single marked effect.) */ VisualType_CharacterBlocks = 1, + /* DOC(Shows a rectangle outline around each marked character. The color aspect determines the color of the rectangle, the text_color aspect is ignored. + +This is a character oriented wire frame style single marked effect.) */ VisualType_CharacterWireFrames = 2, + /* DOC(Shows a single pixel line on the left side of each marked character. The color aspect determines the color of the line, the text_color aspect is ignored. + +This is a character oriented wire frame style single marked effect.) */ VisualType_CharacterIBars = 3, + /* DOC(Shows a block in the background of the entire line on which the marker is placed. The color aspect determines the color of the highlight, the text_color aspect is ignored. + +This is a line oriented highlight style single marked effect.) */ VisualType_LineHighlights = 4, + /* DOC(Shows a block around the background of each character between the range pairs. The color aspect determines the color of the highlight, the text_color aspect is ignored. + +This is a character oriented highlight style range marked effect.) */ VisualType_CharacterHighlightRanges = 5, + /* DOC(Shows a block in the background of the entire line on each line within the range. The color aspect determines the color of the highlight, the text_color aspect is ignored. + +This is a line oriented highlight style range marked effect.) */ VisualType_LineHighlightRanges = 6, VisualType_COUNT = 7, }; + +/* DOC(Special codes that can be used as the color aspects of marker visual effects. These special codes are for convenience and in some cases effects that could not be expressed as 32-bit colors.) */ ENUM(uint32_t, Marker_Visual_Symbolic_Color) { + /* DOC(When default is used for text_color aspect, the text is unchanged from the coloring the core would apply to it. For all effects, the default value of the color aspect for all effects is the same as transparent. For convenience it is guaranteed this will always be the zero value, so that users may simply pass 0 to color aspects they do not wish to set.) */ SymbolicColor_Default = 0, + /* DOC(Since all symbolic color codes have their alpha channel set to zero, this code is reserved to get the effect one would get for using a tranparent 32-bit color.) */ SymbolicColor_Transparent = 1, + /* DOC(This flag bit-ored with a style tag will be reevaluated at render time to the color of the specific tag in the currently active palette. The macro SymbolicColorFromPalette(Stag_CODE) applies the bit-or to Stag_CODE. For example SymbolicColorFromPalette(Stag_Cursor) will always evaluate to the color of the current cursor. Note that this evaluation happens at render time, so that if the palette changes, the evaluated color will also change.) */ SymbolicColor__StagColorFlag = 0x00800000, }; #define SymbolicColorFromPalette(x) ((x)|SymbolicColor__StagColorFlag) + +/* DOC(Not implemented, but reserved for future use. Where this type is used in the API the value passed should always be zero for now.) */ ENUM(int32_t, Marker_Visual_Text_Style) { MARKER_TEXT_STYLE_NOT_YET_IMPLEMENTED, }; + +/* DOC(The take rule of a marker visual specifies how to iterate the markers in the marker object when applying the visual effect. For range marked effects, which use a pair of markers to specify a left inclusive right exclusive range, it is not necessary that two markers be adjacent in the marker object when they are taken. The first taken marker is paired to the second taken marker, the third to the fourth, etc, regardless of any gaps between the consecutively taken markers. If the take rule overflows the marker object, the effect is still applied, but the iteration is cut short as soon as it would overflow.) */ STRUCT Marker_Visual_Take_Rule{ + /* DOC(The index of the first marker to take. Indices are zero based. The default value is zero.) */ int32_t first_index; + /* DOC(From the start of a "step" take_count_per_step markers. Markers taken in the same step have consectuive indices. For example, if the first marker taken has index = 0, and the take_count_per_step = 2, then the second marker taken will have index = 1. The default value is 1.) */ int32_t take_count_per_step; + /* DOC(The stride between each "step". After taking take_count_per_step markers from the current step, the iteation advances to the next step counting from the start of current step. So if 2 markers are taken per step, and the stride is 3, then the pattern of taken markers will be **.**.**.**. where * is a tken marker. The core automatically adjusts this field to be at least equal to take_count_per_step before using it to iterate. The default value is 1.) */ int32_t step_stride_in_marker_count; + /* DOC(The maximum number of markers to be taken durring iteration. Since overflow does not cause the visual effect to fail, and is prevented internally, this field can be set to the max value of a signed 32-bit integer and will take as many markers as possible until it hits the end of the marker object. If the maximum count is reached mid-step, the iteration stops without completeing the step.) */ int32_t maximum_number_of_markers; }; + +/* DOC(A helper enumeration for common priority levels. Although any unsigned integer is a valid priority level, the following five levels are used to establish a standard convention. Highest priority is given to effects immediately at the cursor, mark, and highlighted range. Default priority is given to actively attached effects like compilation error highlights. Passive effects like scope highlighting go to Lowest priority. + +This system is considered a temporary measure and will eventually be replaced with a priority level brokering system to enable cooperation between modules [note made 4.0.29].) */ ENUM(uint32_t, Marker_Visual_Priority_Level){ VisualPriority_Lowest = 0, VisualPriority_Low = 1000, @@ -745,59 +827,86 @@ STRUCT Query_Bar{ String string; }; +/* DOC(An enumeration of the types of UI widget items that can be placed in a UI.) */ ENUM(int16_t, UI_Item_Type){ + /* DOC(An 'option' is a rectangle with a margin that can be highlighted, and a main string in default text color, and a secondary string in pop2 color, on a single line centered vertically in the item rectangle.) */ UIType_Option = 0, + /* DOC(A 'text field' is a rectangle with a query string in pop1 color, and a main string in default text color, on a single line centered verticall in the item rectangle.) */ UIType_TextField = 1, + /* DOC(A 'color theme' is a rectangle that ignores the active color palette and previews a specified color palette, with a specified string on the first line. This item is particularly meant for creating the color theme lister, but could be reused for anything, however there is no way to remove all the sample text in the widget added alongside the main string.) */ UIType_ColorTheme = 2, }; +/* DOC(An enumeration of the levels of activation that can be placed on an item in a UI, this can effect the appearance of some widgets.) */ ENUM(int8_t, UI_Activation_Level){ UIActivation_None = 0, UIActivation_Hover = 1, UIActivation_Active = 2, }; +/* DOC(An enumeration of the coordinate systems in which an item's rectangle can be specified. This is not always a convenience feature as it means after scrolling the widget data does not necessarily needed to be updated, thus saving extra work. All coordiante systems are in pixels, with y increasing downward, and x increasing rightward.) */ ENUM(int8_t, UI_Coordinate_System){ + /* DOC(The 'scrolled' coordiante system is effected by the scroll value of the view. If the y scroll value is at 100 and an item is placed with a vertical range from 50 to 90, the item is not visible. When the y scroll value is at 0, this coordinate system aligns with the view relative coordiante system.) */ UICoordinates_Scrolled = 0, + /* DOC(The 'view relative' coordiante system is only effected by the screen coordinates of the view. (0,0) is always the top left corner of space inside the view margin.) */ UICoordinates_ViewRelative = 1, UICoordinates_COUNT = 2, }; +/* DOC(A UI_Item is essentially the data to specify a single widget. The exact appearance and qualities of a displayed widget are determined by the item's type.) +DOC_SEE(UI_Item_Type) +DOC_SEE(UI_Activation_Level) +DOC_SEE(UI_Coordinate_System) +*/ STRUCT UI_Item{ + /* DOC(The type of the item.) */ UI_Item_Type type; + /* DOC(The activation level of the item.) */ UI_Activation_Level activation_level; + /* DOC(The coordinate system in which the item's rectanlge is expressed.) */ UI_Coordinate_System coordinates; + /* DOC(The rectangle of an item, combined with it's coordinate system, specify where on the screen the widget will be rendered.) */ + i32_Rect rectangle; // 32-bits of padding to fill here union{ struct{ + /* DOC(The main string of an 'option' widget.) */ String string; + /* DOC(The secondary string of an 'option' widget.) */ String status; } option; struct{ + /* DOC(The query string of a 'text field' widget.) */ String query; + /* DOC(The main string of an 'text field' widget.) */ String string; } text_field; struct{ + /* DOC(The custom first line string of the color theme preview block.) */ String string; + /* DOC(The index of the color theme to be used with the preview block.) */ int32_t index; } color_theme; }; + /* DOC(All items can have an attached user_data pointer to associate the item back to whatever user space data or object is needed for interactign with the item.) */ void *user_data; - i32_Rect rectangle; }; +/* DOC(Wraps a UI_Item in a doubly linked list node.) */ STRUCT UI_Item_Node{ UI_Item_Node *next; UI_Item_Node *prev; UI_Item fixed; }; +/* DOC(A zero-ended doubly linked list object.) */ STRUCT UI_List{ UI_Item_Node *first; UI_Item_Node *last; int32_t count; }; +/* DOC(An array of UI_Items and a set of bounding boxes that store the union item rectangle per coordiante system, used to optimize activation and re-render operations.) */ STRUCT UI_Control{ UI_Item *items; int32_t count; diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index 941724a5..ef09af4b 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -79,6 +79,7 @@ struct Application_Links; #define MANAGED_OBJECT_LOAD_DATA_SIG(n) bool32 n(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out) #define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type) #define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app) +#define SET_COMMAND_INPUT_SIG(n) void n(Application_Links *app, Key_Event_Data key_data) #define GET_MOUSE_STATE_SIG(n) Mouse_State n(Application_Links *app) #define START_QUERY_BAR_SIG(n) bool32 n(Application_Links *app, Query_Bar *bar, uint32_t flags) #define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, uint32_t flags) @@ -196,6 +197,7 @@ typedef MANAGED_OBJECT_STORE_DATA_SIG(Managed_Object_Store_Data_Function); typedef MANAGED_OBJECT_LOAD_DATA_SIG(Managed_Object_Load_Data_Function); typedef GET_USER_INPUT_SIG(Get_User_Input_Function); typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function); +typedef SET_COMMAND_INPUT_SIG(Set_Command_Input_Function); typedef GET_MOUSE_STATE_SIG(Get_Mouse_State_Function); typedef START_QUERY_BAR_SIG(Start_Query_Bar_Function); typedef END_QUERY_BAR_SIG(End_Query_Bar_Function); @@ -315,6 +317,7 @@ Managed_Object_Store_Data_Function *managed_object_store_data; Managed_Object_Load_Data_Function *managed_object_load_data; Get_User_Input_Function *get_user_input; Get_Command_Input_Function *get_command_input; +Set_Command_Input_Function *set_command_input; Get_Mouse_State_Function *get_mouse_state; Start_Query_Bar_Function *start_query_bar; End_Query_Bar_Function *end_query_bar; @@ -433,6 +436,7 @@ Managed_Object_Store_Data_Function *managed_object_store_data_; Managed_Object_Load_Data_Function *managed_object_load_data_; Get_User_Input_Function *get_user_input_; Get_Command_Input_Function *get_command_input_; +Set_Command_Input_Function *set_command_input_; Get_Mouse_State_Function *get_mouse_state_; Start_Query_Bar_Function *start_query_bar_; End_Query_Bar_Function *end_query_bar_; @@ -559,6 +563,7 @@ app_links->managed_object_store_data_ = Managed_Object_Store_Data;\ app_links->managed_object_load_data_ = Managed_Object_Load_Data;\ app_links->get_user_input_ = Get_User_Input;\ app_links->get_command_input_ = Get_Command_Input;\ +app_links->set_command_input_ = Set_Command_Input;\ app_links->get_mouse_state_ = Get_Mouse_State;\ app_links->start_query_bar_ = Start_Query_Bar;\ app_links->end_query_bar_ = End_Query_Bar;\ @@ -677,6 +682,7 @@ static inline bool32 managed_object_store_data(Application_Links *app, Managed_O static inline bool32 managed_object_load_data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out){return(app->managed_object_load_data(app, object, first_index, count, mem_out));} static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input(app, get_type, abort_type));} static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input(app));} +static inline void set_command_input(Application_Links *app, Key_Event_Data key_data){(app->set_command_input(app, key_data));} static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state(app));} static inline bool32 start_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){return(app->start_query_bar(app, bar, flags));} static inline void end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar(app, bar, flags));} @@ -795,6 +801,7 @@ static inline bool32 managed_object_store_data(Application_Links *app, Managed_O static inline bool32 managed_object_load_data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out){return(app->managed_object_load_data_(app, object, first_index, count, mem_out));} static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input_(app, get_type, abort_type));} static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input_(app));} +static inline void set_command_input(Application_Links *app, Key_Event_Data key_data){(app->set_command_input_(app, key_data));} static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state_(app));} static inline bool32 start_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){return(app->start_query_bar_(app, bar, flags));} static inline void end_query_bar(Application_Links *app, Query_Bar *bar, uint32_t flags){(app->end_query_bar_(app, bar, flags));} diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 0ebddf6b..efafd13f 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2504,7 +2504,7 @@ Managed_Variable_Create(Application_Links *app, char *null_terminated_name, uint /* DOC_PARAM(null_terminated_name, The unique name for this managed variable.) DOC_PARAM(default_value, The default value that this variable will have in a scope that has not set this variable.) -DOC_RETURN(Returns the Managed_Variable_ID for the new variable on success or zero on failure. This call fails when a variable with the given name alraedy exists.) +DOC_RETURN(Returns the Managed_Variable_ID for the new variable on success and zero on failure. This call fails when a variable with the given name alraedy exists.) DOC(Variables are stored in scopes but creating a variable does not mean that all scopes will allocate space for this variable. Space for variables is allocated sparsly on demand in each scope. Once a variable exists it will exist for the entire duration of the 4coder session and will never have a different id. The id will be used to set and get the value of the variable in managed scopes.) DOC_SEE(managed_variable_get_id) DOC_SEE(managed_variable_create_or_get_id) @@ -2522,7 +2522,7 @@ API_EXPORT Managed_Variable_ID Managed_Variable_Get_ID(Application_Links *app, char *null_terminated_name) /* DOC_PARAM(null_terminated_name, The unique name for this managed variable.) -DOC_RETURN(Returns the Managed_Variable_ID for the variable on success or zero on failure. This call fails when no variable that already exists has the given name.) +DOC_RETURN(Returns the Managed_Variable_ID for the variable on success and zero on failure. This call fails when no variable that already exists has the given name.) DOC_SEE(managed_variable_create) DOC_SEE(managed_variable_create_or_get_id) */ @@ -2610,7 +2610,7 @@ Alloc_Managed_Memory_In_Scope(Application_Links *app, Managed_Scope scope, int32 DOC_PARAM(scope, A handle to the scope in which the new object will be allocated.) DOC_PARAM(item_size, The size, in bytes, of a single 'item' in this memory object. This effects the size of the allocation, and the indexing of the memory in the store and load calls.) DOC_PARAM(count, The number of 'items' allocated for this memory object. The total memory size is item_size*count.) -DOC_RETURN(Returns the handle to the new object on success, or zero on failure. This call fails if scope does not refer to a valid managed scope.) +DOC_RETURN(Returns the handle to the new object on success, and zero on failure. This call fails if scope does not refer to a valid managed scope.) DOC(Managed objects allocate memory that is tied to the scope. When the scope is cleared or destroyed all of the memory allocated in it is freed in bulk and the handles to the objects never again become valid. Thus the handle returned by this call will only ever refer to this memory allocation.) */ { @@ -2638,7 +2638,7 @@ Alloc_Buffer_Markers_On_Buffer(Application_Links *app, Buffer_ID buffer_id, int3 DOC_PARAM(buffer_id, The id for the buffer onto which these markers will be attached. The markers will live in the scope of the buffer, or in another scope dependent on this buffer, thus guaranteeing that when the buffer is closed, all attached markers are freed in bulk with it.) DOC_PARAM(count, The number of Marker items allocated in this object. The total memory size is sizeof(Marker)*count.) DOC_PARAM(optional_extra_scope, If this pointer is non-null, then it is treated as a scope with additional dependencies for the allocated markers. In this case, the scope of buffer and extra scope are unioned via get_managed_scope_with_multiple_dependencies and marker object lives in the resulting scope.) -DOC_RETURN(Returns the handle to the new object on succes, or zero on failure. This call fails if buffer_id does not refer to a valid buffer, or optional_extra_scope does not refer to a valid scope.) +DOC_RETURN(Returns the handle to the new object on succes, and zero on failure. This call fails if buffer_id does not refer to a valid buffer, or optional_extra_scope does not refer to a valid scope.) DOC(The created managed object is essentially a memory object with item size equal to sizeof(Marker). The primary difference is that if the buffer referred to by buffer_id is edited, the position of all markers attached to that buffer can be changed by the core. Thus this not a memory storage so much as position marking and tracking in a buffer.) DOC_SEE(alloc_managed_memory_in_scope) DOC_SEE(Marker) @@ -2698,7 +2698,7 @@ API_EXPORT Marker_Visual Create_Marker_Visual(Application_Links *app, Managed_Object object) /* DOC_PARAM(object, A handle to the marker object on which the new visual will be attached.) -DOC_RETURN(Returns the handle to the newly created marker visual on success, or zero on failure. This call fails when object does not refer to a valid marker object.) +DOC_RETURN(Returns the handle to the newly created marker visual on success, and zero on failure. This call fails when object does not refer to a valid marker object.) DOC(A marker visual adds graphical effects to markers such as cursors, highlight ranges, text colors, etc. A marker object can have any number of attached visuals. The memory in the 4coder core for visuals is stored in the same scope as the object.) DOC_SEE(destroy_marker_visuals) */ @@ -2735,7 +2735,19 @@ get_marker_visual_pointer(Models *models, Marker_Visual visual){ } API_EXPORT bool32 -Marker_Visual_Set_Effect(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style){ +Marker_Visual_Set_Effect(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style) +/* +DOC_PARAM(visual, A handle to the marker visual to be modified by this call.) +DOC_PARAM(type, The new type of visual effect this marker visual will create.) +DOC_PARAM(color, The new color aspect of the effect, exact meaning depends on the type.) +DOC_PARAM(text_color, The new text color aspect of the effect, exact meaning depends on the type.) +DOC_PARAM(text_style, This feature is not yet implemented and the parameter should always be 0.) +DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.) +DOC(Each effect type uses the color and text_color aspects differently. These aspects can be specified as 32-bit colors, or as "symbolic coloes" which are special values small enough that their alpha channels would be zero as 32-bit color codes. Valid symbolic color values have special rules for evaluation, and sometimes their meaning depends on the effect type too.) +DOC_SEE(Marker_Visuals_Type) +DOC_SEE(Marker_Visuals_Symbolic_Color) +*/ +{ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); @@ -2744,12 +2756,21 @@ Marker_Visual_Set_Effect(Application_Links *app, Marker_Visual visual, Marker_Vi data->color = color; data->text_color = text_color; data->text_style = text_style; + return(true); } return(false); } API_EXPORT bool32 -Marker_Visual_Set_Take_Rule(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule){ +Marker_Visual_Set_Take_Rule(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule) +/* +DOC_PARAM(visual, A handle to the marker visual to be modified by this call.) +DOC_PARAM(take_rule, The new take rule for the marker visual.) +DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.) +DOC(Marker visuals have take rules so that they do not necessarily effect every marker in the marker object they were created to visualize. The take rule can effect the start of the run of markers, the total number of markers, and the stride of the markers, "taken" by this visual when applying it's effect. The word "take" should not be thought of as reserving a marker to the particular marker visual, multiple visuals may add effects to a single marker. See the documentation for Marker_Visual_Take_Rule for specifics about how the take rule can be configured.) +DOC_SEE(Marker_Visual_Take_Rule) +*/ +{ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); @@ -2768,48 +2789,84 @@ Marker_Visual_Set_Take_Rule(Application_Links *app, Marker_Visual visual, Marker else{ data->one_past_last_take_index = max_i32; } + return(true); } return(false); } API_EXPORT bool32 -Marker_Visual_Set_Priority(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority){ +Marker_Visual_Set_Priority(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority) +/* +DOC_PARAM(visual, A handle to the marker visual to be modified by this call.) +DOC_PARAM(priority, The new priority level for this marker visual.) +DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.) +DOC(Multiple visuals effecting the same position, whether they are on the same marker object, or different marker objects, are sorted by their priority level, so that higher priority levels are displayed when they are in conflict with lower priority levels. Some effects have implicit priorities over other effects which does not take priority level into account, other effects may occur in the same position without being considered "in conflict". See the documentation for each effect for more information these relationships.) +*/ +{ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); if (data != 0){ data->priority = priority; + return(true); } return(false); } API_EXPORT bool32 -Marker_Visual_Set_View_Key(Application_Links *app, Marker_Visual visual, View_ID key_view_id){ +Marker_Visual_Set_View_Key(Application_Links *app, Marker_Visual visual, View_ID key_view_id) +/* +DOC_PARAM(visual, A handle to the marker visual to be modified by this call.) +DOC_PARAM(key_view_id, The new value of the marker visual's view keying.) +DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does notrefer to a valid marker visual.) +DOC(View keying allows a marker visual to declare that it only appears in one view. For instance, if a buffer is opened in two views side-by-side, and each view has it's own cursor position, this can be used to make sure that the cursor for one view does not appear in the other view.) +*/ +{ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Marker_Visual_Data *data = get_marker_visual_pointer(models, visual); if (data != 0){ data->key_view_id = key_view_id; + return(true); } return(false); } API_EXPORT bool32 -Destroy_Marker_Visual(Application_Links *app, Marker_Visual visual){ +Destroy_Marker_Visual(Application_Links *app, Marker_Visual visual) +/* +DOC_PARAM(visual, A handle to the marker visual to be destroyed.) +DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.) +*/ +{ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Dynamic_Workspace *workspace = get_dynamic_workspace(models, visual.scope); if (workspace != 0){ Marker_Visual_Data *data = dynamic_workspace_get_visual_pointer(workspace, visual.slot_id, visual.gen_id); if (data != 0){ - marker_visual_free(&workspace->visual_allocator, data); + void *ptr = dynamic_workspace_get_pointer(workspace, data->owner_object&max_u32); + Managed_Object_Standard_Header *header = (Managed_Object_Standard_Header*)ptr; + if (header != 0){ + Assert(header->type == ManagedObjectType_Markers); + Managed_Buffer_Markers_Header *markers = (Managed_Buffer_Markers_Header*)header; + zdll_remove(markers->visual_first, markers->visual_last, data); + markers->visual_count -= 1; + marker_visual_free(&workspace->visual_allocator, data); + return(true); + } } } return(false); } API_EXPORT int32_t -Buffer_Markers_Get_Attached_Visual_Count(Application_Links *app, Managed_Object object){ +Buffer_Markers_Get_Attached_Visual_Count(Application_Links *app, Managed_Object object) +/* +DOC_PARAM(object, The handle to the marker object to be queried.) +DOC_RETURN(Returns the number of marker visuals that are currently attached to the given object. If the object handle does not refer to a valid marker object, then this call returns zero.) +*/ +{ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object); @@ -2821,7 +2878,13 @@ Buffer_Markers_Get_Attached_Visual_Count(Application_Links *app, Managed_Object } API_EXPORT Marker_Visual* -Buffer_Markers_Get_Attached_Visual(Application_Links *app, Partition *part, Managed_Object object){ +Buffer_Markers_Get_Attached_Visual(Application_Links *app, Partition *part, Managed_Object object) +/* +DOC_PARAM(part, The arena to be used to allocate the returned array.) +DOC_PARAM(object, The handle to the marker object to be queried.) +DOC_RETURN(Pushes an array onto part containing the handle to every marker visual attached to this object, and returns the pointer to it's base. If the object does not refer to a valid marker object or there is not enough space in part to allocate the array, then a null pointer is returned.) +*/ +{ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object); @@ -2858,6 +2921,10 @@ get_dynamic_object_memory_ptr(Managed_Object_Standard_Header *header){ API_EXPORT uint32_t Managed_Object_Get_Item_Size(Application_Links *app, Managed_Object object) +/* +DOC_PARAM(object, The handle to the managed object to be queried.) +DOC_RETURN(Returns the size, in bytes, of a single item in the managed object. Item size is multiplied by the indices in store and load calls, and it is multiplied by item count to discover the total memory size of the managed object. If object does not refer to a valid managed object, this call returns zero.) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -2870,6 +2937,10 @@ Managed_Object_Get_Item_Size(Application_Links *app, Managed_Object object) API_EXPORT uint32_t Managed_Object_Get_Item_Count(Application_Links *app, Managed_Object object) +/* +DOC_PARAM(object, The handle to the managed object to be queried.) +DOC_RETURN(Returns the count of items this object can store, this count is used to range check the indices in store and load calls. If object does not refer to a valid managed object, this call returns zero.) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -2882,6 +2953,11 @@ Managed_Object_Get_Item_Count(Application_Links *app, Managed_Object object) API_EXPORT Managed_Object_Type Managed_Object_Get_Type(Application_Links *app, Managed_Object object) +/* +DOC_PARAM(object, The handle to the managed object to be queried.) +DOC_RETURN(Returns the type of the managed object, see Managed_Object_Type for the enumeration of possible values and their special meanings. If object does not refer to a valid managed object, this call returns ManagedObjectType_Error.) +DOC_SEE(Managed_Object_Type) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -2898,6 +2974,10 @@ Managed_Object_Get_Type(Application_Links *app, Managed_Object object) API_EXPORT Managed_Scope Managed_Object_Get_Containing_Scope(Application_Links *app, Managed_Object object) +/* +DOC_PARAM(object, The handle to the managed object to be queried.) +DOC_RETURN(Returns a handle to the managed scope in which this object is allocated, or zero if object does not refer to a valid managed object.) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -2911,6 +2991,11 @@ Managed_Object_Get_Containing_Scope(Application_Links *app, Managed_Object objec API_EXPORT bool32 Managed_Object_Free(Application_Links *app, Managed_Object object) +/* +DOC_PARAM(object, The handle to the managed object to be freed.) +DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when object does not refer to a valid managed object.) +DOC(Permanently frees the specified object. Not only does this free up the memory this object had allocated, but it also triggers cleanup for some types of managed objects. For instance after markers are freed, any visual effects from the markers are removed as well. See Managed_Object_Type for more information about what cleanup each type performs when it is freed.) + */ { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -2938,6 +3023,16 @@ Managed_Object_Free(Application_Links *app, Managed_Object object) API_EXPORT bool32 Managed_Object_Store_Data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem) +/* +DOC_PARAM(object, The handle to the managed object in which data will be stored.) +DOC_PARAM(first_index, The first index of the range in the managed object to be stored. Managed object indics are zero based.) +DOC_PARAM(count, The number of items in the managed object to be stored.) +DOC_PARAM(mem, A pointer to the data to be stored, it is expected that the size of this memory is item_size*count, item_size can be queried with managed_object_get_item_size.) +DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when object does not refer to a valid managed object, and when the range of indices overflows the range of this managed object. The range of the managed object can be queried with managed_object_get_item_count.) +DOC(All managed objects, in addition to whatever special behaviors they have, have the ability to store and load data. This storage can have special properties in certain managed object types, for instance, the data stored in marker objects are edited by the core when the buffer to which they are attached is edited. This call stores the data pointed to by mem into the item range specified by first_index and count.) +DOC_SEE(managed_object_get_item_size) +DOC_SEE(managed_object_get_item_count) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -2957,6 +3052,16 @@ Managed_Object_Store_Data(Application_Links *app, Managed_Object object, uint32_ API_EXPORT bool32 Managed_Object_Load_Data(Application_Links *app, Managed_Object object, uint32_t first_index, uint32_t count, void *mem_out) +/* +DOC_PARAM(object, The handle to the managed object from which data will be loaded.) +DOC_PARAM(first_index, The first index of the range in the managed object to be loaded. Managed object indics are zero based.) +DOC_PARAM(count, The number of items in the managed object to be loaded.) +DOC_PARAM(mem_out, A pointer to the memory where loaded data will be written, it is expected that the size of this memory is item_size*count, item_size can be queried with managed_object_get_item_size.) +DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when object does not refer to a valid managed object, and when the range of indices overflows the range of this managed object. The range of the managed object can be queried with managed_object_get_item_count.) +DOC(All managed objects, in addition to whatever special behaviors they have, have the ability to store and load data. This storage can have special properties in certain managed object types, for instance, the data stored in marker objects are edited by the core when the buffer to which they are attached is edited. This call loads the data from the item range specified by first_index and count into mem_out.) +DOC_SEE(managed_object_get_item_size) +DOC_SEE(managed_object_get_item_count) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; @@ -3013,7 +3118,7 @@ DOC_RETURN(This call returns the input that triggered the currently executing co DOC_SEE(User_Input) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; - User_Input result; + User_Input result = {0}; result.type = UserInputKey; result.abort = 0; result.key = cmd->key; @@ -3021,6 +3126,15 @@ DOC_SEE(User_Input) return(result); } +API_EXPORT void +Set_Command_Input(Application_Links *app, Key_Event_Data key_data) +/* +DOC_PARAM(key_data, The new value of the "command input". Setting this effects the result returned by get_command_input until the end of this command.) +*/{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + cmd->key = key_data; +} + API_EXPORT Mouse_State Get_Mouse_State(Application_Links *app) /* @@ -3085,6 +3199,9 @@ DOC(This call posts a string to the *messages* buffer.) API_EXPORT int32_t Get_Theme_Count(Application_Links *app) +/* +DOC_RETURN(Returns the number of themes that currently exist in the core.) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Style_Library *library = &cmd->models->styles; @@ -3093,10 +3210,14 @@ Get_Theme_Count(Application_Links *app) API_EXPORT String Get_Theme_Name(Application_Links *app, struct Partition *arena, int32_t index) +/* +DOC_PARAM(arena, The arena which will be used to allocate the returned string.) +DOC_PARAM(index, The index of the theme to query. Index zero always refers to the active theme, all other indices refer to the static copies of available themes.) +DOC_RETURN(On success this call returns a string allocated on arena that is the name of the queried theme, on failure a null string is returned. This call fails when index is not less than the total number of themes, and when there is not enough space in arena to allocate the return string.) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Style_Library *library = &cmd->models->styles; - String str = {0}; if (0 <= index && index < library->count){ Style *style = &library->styles[index]; @@ -3109,7 +3230,6 @@ Get_Theme_Name(Application_Links *app, struct Partition *arena, int32_t index) str.str[str.size] = 0; } } - return(str); } @@ -3168,6 +3288,10 @@ DOC(This call changes 4coder's color pallet to one of the built in themes.) API_EXPORT bool32 Change_Theme_By_Index(Application_Links *app, int32_t index) +/* +DOC_PARAM(index, The index parameter specifies the index of theme to begin using.) +DOC_RETURN(Returns non-zero on success and zero on failure. This call fails when index is not less than the total number of themes.) +*/ { Command_Data *cmd = (Command_Data*)app->cmd_context; Style_Library *styles = &cmd->models->styles; diff --git a/site/4ed_sitegen.cpp b/site/4ed_sitegen.cpp index 5793fd10..9d49dff7 100644 --- a/site/4ed_sitegen.cpp +++ b/site/4ed_sitegen.cpp @@ -56,24 +56,6 @@ enum{ MDFR_SHIFT = 0x8, }; -global char long_commands_str[] = R"foo( -\SECTION{4coder Long Command} -Long name commands that can be typed in after using the "long command" command for infrequently triggered commands. -\LIST -\ITEM \STYLE{code} "load project" \END Load a project.4coder file, ditching any previously loaded project -\ITEM \STYLE{code} "open all code" \END Open all code files in the current directory, extensions set in config.4coder, default to C/C++ extensions -\ITEM \STYLE{code} "open all code recursive" \END Like \STYLE{code} "open all code" \END but recurses through folders -\ITEM \STYLE{code} "dos lines" \END Switch the buffer to 'dos' line ending mode CRLF -\ITEM \STYLE{code} "nix lines" \END Switch the buffer to 'nix' line ending mode LF -\ITEM \STYLE{code} "remap" \END Change to one of the built in command bindings -\ITEM \STYLE{code} "new project" \END Setup a new project.4coder and accompanying build scripts -\ITEM \STYLE{code} "delete file" \END Delete the file attached to the current buffer and close the buffer -\ITEM \STYLE{code} "rename file" \END Rename the file attached to the current buffer and reopen the buffer -\ITEM \STYLE{code} "mkdir" \END Make a new directory in 4coder's hot directory -\END -\END -)foo"; - internal void generate_binding_list(char *code_directory, char *src_directory){ char full_path[512]; @@ -104,8 +86,6 @@ generate_binding_list(char *code_directory, char *src_directory){ } fprintf(out, "\\END\n"); - fprintf(out, long_commands_str); - for (i32 i = 0; i < ArrayCount(fcoder_meta_maps); ++i){ Meta_Mapping *mapping = &fcoder_meta_maps[i]; diff --git a/site/source_material/binding_list.txt b/site/source_material/binding_list.txt index e1e088c5..68eec9d3 100644 --- a/site/source_material/binding_list.txt +++ b/site/source_material/binding_list.txt @@ -1,3 +1,4 @@ + \INCLUDE{site_header.txt} 4coder version \VERSION @@ -6,22 +7,6 @@ \ITEM \STYLE{code} "default" \END The default 4coder bindings - typically good for Windows and Linux \ITEM \STYLE{code} "mac-default" \END Default 4coder bindings on a Mac keyboard \END - -\SECTION{4coder Long Command} -Long name commands that can be typed in after using the "long command" command for infrequently triggered commands. -\LIST -\ITEM \STYLE{code} "load project" \END Load a project.4coder file, ditching any previously loaded project -\ITEM \STYLE{code} "open all code" \END Open all code files in the current directory, extensions set in config.4coder, default to C/C++ extensions -\ITEM \STYLE{code} "open all code recursive" \END Like \STYLE{code} "open all code" \END but recurses through folders -\ITEM \STYLE{code} "dos lines" \END Switch the buffer to 'dos' line ending mode CRLF -\ITEM \STYLE{code} "nix lines" \END Switch the buffer to 'nix' line ending mode LF -\ITEM \STYLE{code} "remap" \END Change to one of the built in command bindings -\ITEM \STYLE{code} "new project" \END Setup a new project.4coder and accompanying build scripts -\ITEM \STYLE{code} "delete file" \END Delete the file attached to the current buffer and close the buffer -\ITEM \STYLE{code} "rename file" \END Rename the file attached to the current buffer and reopen the buffer -\ITEM \STYLE{code} "mkdir" \END Make a new directory in 4coder's hot directory -\END -\END \SECTION{Map: default} \SECTION{mapid-global} The following bindings apply in all situations. @@ -223,7 +208,7 @@ The following bindings apply in all situations. \ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations. \ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the first jump in the buffer. \ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END Toggles the visibility status of the current view's filebar. +\ITEM \STYLE{code} \END Toggles the visibility status of the current view's filebar. \ITEM \STYLE{code} \END Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer. \ITEM \STYLE{code} \END If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command. \ITEM \STYLE{code} \END Opens an interactive list of all registered commands. diff --git a/string/internal_4coder_string.cpp b/string/internal_4coder_string.cpp index b5b165c8..c7684642 100644 --- a/string/internal_4coder_string.cpp +++ b/string/internal_4coder_string.cpp @@ -1240,7 +1240,19 @@ non-zero if dest does not run out of space in the underlying memory.) */{ // API_EXPORT FSTRING_LINK void -string_interpret_escapes(String src, char *dst){ +string_interpret_escapes(String src, char *dst) +/* DOC(Rewrites a string with escape sequences into a flattened string. In particular: + +"\\" becomes "\" + +"\n" becomes LF + +"\t" becomes TAB + +"\"" becomes """ + +"0" becomes NULL +) */{ i32_4tech mode = 0; i32_4tech j = 0; for (i32_4tech i = 0; i < src.size; ++i){ diff --git a/todo.txt b/todo.txt index 048becb8..2f06b1bf 100644 --- a/todo.txt +++ b/todo.txt @@ -3,16 +3,11 @@ Features { [] Declarative system for keyword direct coloring + [] set_command_input } Bugs { - [x] Before '.' name matches don't sort to the top like they're supposed to. - [x] notepad like mode - select scope range snap shouldn't happen - [x] highlight high priority vs block low priority should win - [x] new files don't get their automatically inserted comments anymore - [x] nodepad like mode - when moving the cursor in a non-active view, there is no marker snap - [x] notepad like mode - can't tell which view is active, only highlight line in active view? Repro Needed { } @@ -24,64 +19,6 @@ Documentation { - [x] buffer_get_managed_scope - [x] view_get_managed_scope - [x] view_start_ui_mode - [x] view_end_ui_mode - [x] view_set_ui - [x] view_get_ui_copy - [x] create_user_managed_scope - [x] destroy_user_managed_scope - [x] get_global_managed_scope - [x] get_managed_scope_with_multiple_dependencies - [x] managed_scope_clear_contents - [x] clear_managed_scope_and_all_dependent_scopes - [x] managed_variable_create - [x] managed_variable_get_id - [x] managed_variable_create_or_get_id - [x] managed_variable_set - [x] managed_variable_get - [x] alloc_managed_memory_in_scope - [x] alloc_buffer_markers_on_buffer - [x] create_marker_visuals - [] marker_visuals_set_look - [] marker_visuals_set_take_rule - [] marker_visuals_set_priority - [] marker_visuals_set_view_key - [] destroy_marker_visuals - [] buffer_markers_get_attached_visuals_count - [] buffer_markers_get_attached_visuals - [] managed_object_get_item_size - [] managed_object_get_item_count - [] managed_object_get_type - [] managed_object_get_containing_scope - [] managed_object_free - [] managed_object_store_data - [] managed_object_load_data - [] get_theme_count - [] get_theme_name - [] change_theme_by_index - [] Buffer_Kill_Result - [] Range_Array - [] Managed_Object_Type - [] Managed_Scope - [] Managed_Variable_ID - [] Managed_Object - [] Marker_Visuals - [] Marker_Visuals_Type - [] Marker_Visuals_Symbolic_Color - [] Marker_Visuals_Text_Style - [] Marker_Visuals_Take_Rule - [] Marker_Visuals_Priority_Level - [] UI_Item_Type - [] UI_Activation_Level - [] UI_Coordinate_System - [] UI_Item - [] UI_Item_Node - [] UI_List - [] UI_Control - [] Buffer_Name_Conflict_Entry - [] string_interpret_escapes } } @@ -195,5 +132,66 @@ Change Log [x] Cleanup names in Marker_Visuals API } + + NEW THINGS + { + [x] buffer_get_managed_scope + [x] view_get_managed_scope + [x] view_start_ui_mode + [x] view_end_ui_mode + [x] view_set_ui + [x] view_get_ui_copy + [x] create_user_managed_scope + [x] destroy_user_managed_scope + [x] get_global_managed_scope + [x] get_managed_scope_with_multiple_dependencies + [x] managed_scope_clear_contents + [x] clear_managed_scope_and_all_dependent_scopes + [x] managed_variable_create + [x] managed_variable_get_id + [x] managed_variable_create_or_get_id + [x] managed_variable_set + [x] managed_variable_get + [x] alloc_managed_memory_in_scope + [x] alloc_buffer_markers_on_buffer + [x] create_marker_visuals + [x] marker_visuals_set_look + [x] marker_visuals_set_take_rule + [x] marker_visuals_set_priority + [x] marker_visuals_set_view_key + [x] destroy_marker_visuals + [x] buffer_markers_get_attached_visuals_count + [x] buffer_markers_get_attached_visuals + [x] managed_object_get_item_size + [x] managed_object_get_item_count + [x] managed_object_get_type + [x] managed_object_get_containing_scope + [x] managed_object_free + [x] managed_object_store_data + [x] managed_object_load_data + [x] get_theme_count + [x] get_theme_name + [x] change_theme_by_index + [x] Buffer_Kill_Result + [x] Range_Array + [x] Managed_Object_Type + [x] Managed_Scope + [x] Managed_Variable_ID + [x] Managed_Object + [x] Marker_Visuals + [x] Marker_Visuals_Type + [x] Marker_Visuals_Symbolic_Color + [x] Marker_Visuals_Text_Style + [x] Marker_Visuals_Take_Rule + [x] Marker_Visuals_Priority_Level + [x] UI_Item_Type + [x] UI_Activation_Level + [x] UI_Coordinate_System + [x] UI_Item + [x] UI_Item_Node + [x] UI_List + [x] UI_Control + [x] string_interpret_escapes + } }