From 309d6b03aca7f8491cd64a99de8c4b372b194f72 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 4 Apr 2019 19:03:36 -0700 Subject: [PATCH] Buffer_Summary completely shifted into transition files --- 4coder_api_transition_30_31_helpers.cpp | 61 +++ 4coder_base_commands.cpp | 593 ++++++++++++------------ 4coder_base_types.cpp | 57 ++- 4coder_base_types.h | 15 + 4coder_build_commands.cpp | 89 ++-- 4coder_casey_pending.cpp | 510 -------------------- 4coder_clipboard.cpp | 40 +- 4coder_default_framework.cpp | 59 +-- 4coder_experiments.cpp | 78 ++-- 4coder_font_helper.cpp | 10 +- 4coder_generated/app_functions.h | 12 +- 4coder_generated/command_metadata.h | 292 ++++++------ 4coder_helper.cpp | 157 +++++-- 4coder_insertion.cpp | 21 +- 4coder_jump_direct.cpp | 26 +- 4coder_jump_sticky.cpp | 57 +-- 4coder_jumping.cpp | 7 +- 4coder_lists.cpp | 111 +++-- 4coder_miblo_numbers.cpp | 36 +- 4coder_project_commands.cpp | 34 +- 4coder_search.cpp | 46 +- 4coder_ui_helper.cpp | 10 +- 4ed.cpp | 10 +- 4ed_api_implementation.cpp | 21 +- 24 files changed, 1021 insertions(+), 1331 deletions(-) delete mode 100644 4coder_casey_pending.cpp diff --git a/4coder_api_transition_30_31_helpers.cpp b/4coder_api_transition_30_31_helpers.cpp index f14b6c4f..8f9f64b4 100644 --- a/4coder_api_transition_30_31_helpers.cpp +++ b/4coder_api_transition_30_31_helpers.cpp @@ -536,6 +536,67 @@ jump_to_location(Application_Links *app, View_Summary *view, Buffer_Summary *buf } } +static Buffer_Summary +buffer_identifier_to_buffer_summary(Application_Links *app, Buffer_Identifier identifier, Access_Flag access){ + Buffer_Summary buffer = {}; + if (identifier.id != 0){ + buffer = get_buffer(app, identifier.id, access); + } + else{ + buffer = get_buffer_by_name(app, identifier.name, identifier.name_len, access); + if (!buffer.exists){ + buffer = get_buffer_by_file_name(app, identifier.name, identifier.name_len, access); + } + } + return(buffer); +} + +static void +refresh_buffer(Application_Links *app, Buffer_Summary *buffer){ + get_buffer_summary(app, buffer->buffer_id, AccessAll, buffer); +} + +static Sticky_Jump_Array +parse_buffer_to_jump_array(Application_Links *app, Partition *arena, Buffer_Summary buffer){ + return(parse_buffer_to_jump_array(app, arena, buffer.buffer_id)); +} + +static void +lock_jump_buffer(Buffer_Summary buffer){ + lock_jump_buffer(buffer.buffer_name, buffer.buffer_name_len); +} + +static Face_Description +get_buffer_face_description(Application_Links *app, Buffer_Summary *buffer){ + Face_Description result = {}; + if (buffer != 0){ + result = get_buffer_face_description(app, buffer->buffer_id); + } + return(result); +} + +static void +set_buffer_face_by_name(Application_Links *app, Buffer_Summary *buffer, char *name, i32 len){ + if (buffer != 0){ + set_buffer_face_by_name(app, buffer->buffer_id, name, len); + } +} + +static i32 +get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_out){ + return(get_build_directory(app, buffer==0?0:buffer->buffer_id, dir_out)); +} + +static void +execute_standard_build(Application_Links *app, View_Summary *view, Buffer_Summary *active_buffer){ + execute_standard_build(app, view, active_buffer==0?0:active_buffer->buffer_id); +} + +static b32 +post_buffer_range_to_clipboard(Application_Links *app, Partition *scratch, i32 clipboard_index, Buffer_Summary *buffer, i32 first, i32 one_past_last){ + return(post_buffer_range_to_clipboard(app, scratch, clipboard_index, buffer==0?0:buffer->buffer_id, first, one_past_last)); +} + #endif // BOTTOM diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index 7f79e949..0dbb9657 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -12,22 +12,23 @@ write_character_parameter(Application_Links *app, u8 *character, u32 length){ if_view_has_highlighted_range_delete_range(app, view.view_id); view = get_view(app, view.view_id, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); i32 pos = view.cursor.pos; // NOTE(allen): setup markers to figure out the new position of cursor after the insert Marker next_cursor_marker = {}; - next_cursor_marker.pos = character_pos_to_pos(app, &view, &buffer, view.cursor.character_pos); + next_cursor_marker.pos = character_pos_to_pos(app, &view, view.cursor.character_pos); next_cursor_marker.lean_right = true; - Managed_Object handle = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 1, 0); + Managed_Object handle = alloc_buffer_markers_on_buffer(app, buffer, 1, 0); managed_object_store_data(app, handle, 0, 1, &next_cursor_marker); // NOTE(allen): consecutive inserts merge logic History_Record_Index first_index = 0; - buffer_history_get_current_state_index(app, buffer.buffer_id, &first_index); + buffer_history_get_current_state_index(app, buffer, &first_index); b32 do_merge = false; if (character[0] != '\n'){ - Record_Info record = get_single_record(app, buffer.buffer_id, first_index); + Record_Info record = get_single_record(app, buffer, first_index); if (record.error == RecordError_NoError && record.kind == RecordKind_Single){ String string = record.single.string_forward; i32 last_end = record.single.first + string.size; @@ -46,13 +47,13 @@ write_character_parameter(Application_Links *app, u8 *character, u32 length){ } // NOTE(allen): perform the edit - b32 edit_success = buffer_replace_range(app, &buffer, pos, pos, (char*)character, length); + b32 edit_success = buffer_replace_range(app, buffer, pos, pos, make_string((char*)character, length)); // NOTE(allen): finish merging records if necessary if (do_merge){ History_Record_Index last_index = 0; - buffer_history_get_current_state_index(app, buffer.buffer_id, &last_index); - buffer_history_merge_record_range(app, buffer.buffer_id, first_index, last_index, RecordMergeFlag_StateInRange_MoveStateForward); + buffer_history_get_current_state_index(app, buffer, &last_index); + buffer_history_merge_record_range(app, buffer, first_index, last_index, RecordMergeFlag_StateInRange_MoveStateForward); } // NOTE(allen): finish updating the cursor @@ -83,17 +84,19 @@ CUSTOM_DOC("Inserts an underscore.") CUSTOM_COMMAND_SIG(delete_char) CUSTOM_DOC("Deletes the character to the right of the cursor.") { - u32 access = AccessOpen; - View_Summary view = get_active_view(app, access); + View_Summary view = get_active_view(app, AccessOpen); if (!if_view_has_highlighted_range_delete_range(app, view.view_id)){ view = get_view(app, view.view_id, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); i32 start = view.cursor.pos; - if (0 <= start && start < buffer.size){ + i32 buffer_size = 0; + buffer_get_size(app, buffer, &buffer_size); + if (0 <= start && start < buffer_size){ Full_Cursor cursor = {}; view_compute_cursor(app, &view, seek_character_pos(view.cursor.character_pos + 1), &cursor); i32 end = cursor.pos; - buffer_replace_range(app, &buffer, start, end, 0, 0); + buffer_replace_range(app, buffer, start, end, make_lit_string("")); } } } @@ -101,17 +104,19 @@ CUSTOM_DOC("Deletes the character to the right of the cursor.") CUSTOM_COMMAND_SIG(backspace_char) CUSTOM_DOC("Deletes the character to the left of the cursor.") { - u32 access = AccessOpen; - View_Summary view = get_active_view(app, access); + View_Summary view = get_active_view(app, AccessOpen); if (!if_view_has_highlighted_range_delete_range(app, view.view_id)){ view = get_view(app, view.view_id, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); i32 end = view.cursor.pos; - if (0 < end && end <= buffer.size){ + i32 buffer_size = 0; + buffer_get_size(app, buffer, &buffer_size); + if (0 < end && end <= buffer_size){ Full_Cursor cursor = {}; view_compute_cursor(app, &view, seek_character_pos(view.cursor.character_pos - 1), &cursor); i32 start = cursor.pos; - if (buffer_replace_range(app, &buffer, start, end, 0, 0)){ + if (buffer_replace_range(app, buffer, start, end, make_lit_string(""))){ view_set_cursor(app, &view, seek_character_pos(view.cursor.character_pos - 1), true); } } @@ -139,11 +144,11 @@ CUSTOM_DOC("Swaps the position of the cursor and the mark.") CUSTOM_COMMAND_SIG(delete_range) CUSTOM_DOC("Deletes the text in the range between the cursor and the mark.") { - u32 access = AccessOpen; - View_Summary view = get_active_view(app, access); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + View_Summary view = get_active_view(app, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Range range = get_view_range(&view); - buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); + buffer_replace_range(app, buffer, range.min, range.max, make_lit_string("")); } //////////////////////////////// @@ -183,7 +188,7 @@ CUSTOM_DOC("Sets the left size of the view near the x position of the cursor.") static b32 view_space_from_screen_space_checked(Vec2_i32 p, Rect_i32 file_region, Vec2 scroll_p, Vec2 *p_out){ b32 result = false; - if (hit_check(file_region, p)){ + if (rect_contains_point(file_region, p)){ *p_out = view_space_from_screen_space(V2(p), V2(file_region.p0), scroll_p); result = true; } @@ -390,9 +395,12 @@ CUSTOM_COMMAND_SIG(select_all) CUSTOM_DOC("Puts the cursor at the top of the file, and the mark at the bottom of the file.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); + i32 buffer_size = 0; + buffer_get_size(app, buffer, &buffer_size); view_set_cursor(app, &view, seek_pos(0), true); - view_set_mark(app, &view, seek_pos(buffer.size)); + view_set_mark(app, &view, seek_pos(buffer_size)); no_mark_snap_to_cursor(app, view.view_id); } @@ -402,18 +410,17 @@ CUSTOM_COMMAND_SIG(to_uppercase) CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark to uppercase.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Range range = get_view_range(&view); i32 size = range.max - range.min; if (size <= app->memory_size){ char *mem = (char*)app->memory; - - buffer_read_range(app, &buffer, range.min, range.max, mem); + buffer_read_range(app, buffer, range.min, range.max, mem); for (i32 i = 0; i < size; ++i){ mem[i] = char_to_upper(mem[i]); } - buffer_replace_range(app, &buffer, range.min, range.max, mem, size); + buffer_replace_range(app, buffer, range.min, range.max, make_string(mem, size)); view_set_cursor(app, &view, seek_pos(range.max), true); } } @@ -422,18 +429,17 @@ CUSTOM_COMMAND_SIG(to_lowercase) CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark to lowercase.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Range range = get_view_range(&view); i32 size = range.max - range.min; if (size <= app->memory_size){ char *mem = (char*)app->memory; - - buffer_read_range(app, &buffer, range.min, range.max, mem); + buffer_read_range(app, buffer, range.min, range.max, mem); for (i32 i = 0; i < size; ++i){ mem[i] = char_to_lower(mem[i]); } - buffer_replace_range(app, &buffer, range.min, range.max, mem, size); + buffer_replace_range(app, buffer, range.min, range.max, make_string(mem, size)); view_set_cursor(app, &view, seek_pos(range.max), true); } } @@ -565,9 +571,10 @@ CUSTOM_COMMAND_SIG(toggle_line_wrap) CUSTOM_DOC("Toggles the current buffer's line wrapping status.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); b32 unwrapped = view.unwrapped_lines; - buffer_set_setting(app, &buffer, BufferSetting_WrapLine, unwrapped); + buffer_set_setting(app, buffer, BufferSetting_WrapLine, unwrapped); } CUSTOM_COMMAND_SIG(toggle_fps_meter) @@ -580,31 +587,32 @@ CUSTOM_COMMAND_SIG(increase_line_wrap) CUSTOM_DOC("Increases the current buffer's width for line wrapping.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); i32 wrap = 0; - buffer_get_setting(app, &buffer, BufferSetting_WrapPosition, &wrap); - buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, wrap + 10); + buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap); + buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap + 10); } CUSTOM_COMMAND_SIG(decrease_line_wrap) CUSTOM_DOC("Decrases the current buffer's width for line wrapping.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); i32 wrap = 0; - buffer_get_setting(app, &buffer, BufferSetting_WrapPosition, &wrap); - buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, wrap - 10); + buffer_get_setting(app, buffer, BufferSetting_WrapPosition, &wrap); + buffer_set_setting(app, buffer, BufferSetting_WrapPosition, wrap - 10); } CUSTOM_COMMAND_SIG(increase_face_size) CUSTOM_DOC("Increase the size of the face used by the current buffer.") { View_Summary view = get_active_view(app, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessAll); - - Face_ID face_id = get_face_id(app, &buffer); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessAll, &buffer); + Face_ID face_id = 0; + get_face_id(app, buffer, &face_id); Face_Description description = get_face_description(app, face_id); ++description.pt_size; try_modify_face(app, face_id, &description); @@ -614,9 +622,10 @@ CUSTOM_COMMAND_SIG(decrease_face_size) CUSTOM_DOC("Decrease the size of the face used by the current buffer.") { View_Summary view = get_active_view(app, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessAll); - - Face_ID face_id = get_face_id(app, &buffer); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessAll, &buffer); + Face_ID face_id = 0; + get_face_id(app, buffer, &face_id); Face_Description description = get_face_description(app, face_id); --description.pt_size; try_modify_face(app, face_id, &description); @@ -643,11 +652,11 @@ CUSTOM_COMMAND_SIG(toggle_virtual_whitespace) CUSTOM_DOC("Toggles the current buffer's virtual whitespace status.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); i32 vwhite = 0; - buffer_get_setting(app, &buffer, BufferSetting_VirtualWhitespace, &vwhite); - buffer_set_setting(app, &buffer, BufferSetting_VirtualWhitespace, !vwhite); + buffer_get_setting(app, buffer, BufferSetting_VirtualWhitespace, &vwhite); + buffer_set_setting(app, buffer, BufferSetting_VirtualWhitespace, !vwhite); } CUSTOM_COMMAND_SIG(toggle_show_whitespace) @@ -667,16 +676,18 @@ CUSTOM_COMMAND_SIG(eol_dosify) CUSTOM_DOC("Puts the buffer in DOS line ending mode.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - buffer_set_setting(app, &buffer, BufferSetting_Eol, 1); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + buffer_set_setting(app, buffer, BufferSetting_Eol, 1); } CUSTOM_COMMAND_SIG(eol_nixify) CUSTOM_DOC("Puts the buffer in NIX line ending mode.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - buffer_set_setting(app, &buffer, BufferSetting_Eol, 0); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + buffer_set_setting(app, buffer, BufferSetting_Eol, 0); } CUSTOM_COMMAND_SIG(exit_4coder) @@ -1075,24 +1086,19 @@ CUSTOM_COMMAND_SIG(query_replace) CUSTOM_DOC("Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - if (!buffer.exists){ - return; + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + if (buffer != 0){ + Query_Bar replace = {}; + char replace_space[1024]; + replace.prompt = make_lit_string("Replace: "); + replace.string = make_fixed_width_string(replace_space); + if (query_user_string(app, &replace)){ + if (replace.string.size > 0){ + query_replace_parameter(app, replace.string, view.cursor.pos, false); + } + } } - - Query_Bar replace = {}; - char replace_space[1024]; - replace.prompt = make_lit_string("Replace: "); - replace.string = make_fixed_width_string(replace_space); - - if (!query_user_string(app, &replace)){ - return; - } - if (replace.string.size == 0){ - return; - } - - query_replace_parameter(app, replace.string, view.cursor.pos, false); } CUSTOM_COMMAND_SIG(query_replace_identifier) @@ -1100,17 +1106,15 @@ CUSTOM_DOC("Queries the user for a string, and incrementally replace every occur { View_Summary view = get_active_view(app, AccessOpen); Buffer_ID buffer_id = 0; - view_get_buffer(app, view.view_id, AccessProtected, &buffer_id); - if (!buffer_exists(app, buffer_id)){ - return; - } - - Range range = {}; - char space[256]; - String replace = read_identifier_at_pos(app, buffer_id, view.cursor.pos, space, sizeof(space), &range); - - if (replace.size != 0){ - query_replace_parameter(app, replace, range.min, true); + view_get_buffer(app, view.view_id, AccessOpen, &buffer_id); + if (buffer_id != 0){ + Range range = {}; + char space[256]; + String replace = read_identifier_at_pos(app, buffer_id, view.cursor.pos, space, sizeof(space), &range); + + if (replace.size != 0){ + query_replace_parameter(app, replace, range.min, true); + } } } @@ -1118,42 +1122,48 @@ CUSTOM_COMMAND_SIG(query_replace_selection) CUSTOM_DOC("Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - if (!buffer.exists){ - return; - } - - Partition *part = &global_part; - Temp_Memory temp = begin_temp_memory(part); - - Range range = get_view_range(&view); - i32 replace_length = range.max - range.min; - if (replace_length != 0){ - char *replace_space = push_array(part, char, replace_length); - if (buffer_read_range(app, &buffer, range.min, range.max, replace_space)){ - String replace = make_string(replace_space, replace_length); - query_replace_parameter(app, replace, range.min, true); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + if (buffer != 0){ + + Partition *part = &global_part; + Temp_Memory temp = begin_temp_memory(part); + + Range range = get_view_range(&view); + i32 replace_length = range.max - range.min; + if (replace_length != 0){ + char *replace_space = push_array(part, char, replace_length); + if (buffer_read_range(app, buffer, range.min, range.max, replace_space)){ + String replace = make_string(replace_space, replace_length); + query_replace_parameter(app, replace, range.min, true); + } } + + end_temp_memory(temp); } - - end_temp_memory(temp); } //////////////////////////////// static void save_all_dirty_buffers_with_postfix(Application_Links *app, String postfix){ - for (Buffer_Summary buffer = get_buffer_first(app, AccessOpen); - buffer.exists; - get_buffer_next(app, &buffer, AccessOpen)){ - if (buffer.dirty == DirtyState_UnsavedChanges){ - String file_name = make_string(buffer.file_name, buffer.file_name_len); + Arena *scratch = context_get_arena(app); + Buffer_ID buffer = 0; + for (get_buffer_next(app, 0, AccessOpen, &buffer); + buffer != 0; + get_buffer_next(app, buffer, AccessOpen, &buffer)){ + Dirty_State dirty = 0; + buffer_get_dirty_state(app, buffer, &dirty); + if (dirty == DirtyState_UnsavedChanges){ + Temp_Memory_Arena temp = begin_temp_memory(scratch); + String file_name = buffer_push_file_name(app, buffer, scratch); if (file_name.size >= postfix.size){ String file_name_post = substr_tail(file_name, file_name.size - postfix.size); if (match(file_name_post, postfix)){ - save_buffer(app, &buffer, buffer.file_name, buffer.file_name_len, 0); + buffer_save(app, buffer, file_name, 0); } } + end_temp_memory(temp); } } } @@ -1168,10 +1178,8 @@ CUSTOM_DOC("Saves all buffers marked dirty (showing the '*' indicator).") static void delete_file_base(Application_Links *app, String file_name, Buffer_ID buffer_id){ String path = path_of_directory(file_name); - char space[4096]; String cmd = make_fixed_width_string(space); - #if defined(IS_WINDOWS) append(&cmd, "del "); #elif defined(IS_LINUX) || defined(IS_MAC) @@ -1182,9 +1190,7 @@ delete_file_base(Application_Links *app, String file_name, Buffer_ID buffer_id){ append(&cmd, '"'); append(&cmd, front_of_directory(file_name)); append(&cmd, '"'); - exec_system_command(app, 0, buffer_identifier(0), path.str, path.size, cmd.str, cmd.size, 0); - kill_buffer(app, buffer_identifier(buffer_id), 0, BufferKill_AlwaysKill); } @@ -1192,12 +1198,12 @@ CUSTOM_COMMAND_SIG(delete_file_query) CUSTOM_DOC("Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.") { View_Summary view = get_active_view(app, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessAll); - - if (buffer.file_name != 0){ - String file_name = {}; - file_name = make_string(buffer.file_name, buffer.file_name_len); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessAll, &buffer); + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + String file_name = buffer_push_file_name(app, buffer, scratch); + if (file_name.size > 0){ char space[4096]; Query_Bar bar; bar.prompt = make_fixed_width_string(space); @@ -1205,97 +1211,109 @@ CUSTOM_DOC("Deletes the file of the current buffer if 4coder has the appropriate append(&bar.prompt, file_name); append(&bar.prompt, "' (Y)es, (n)o"); bar.string = null_string; - if (start_query_bar(app, &bar, 0) == 0) return; - - User_Input in = get_user_input(app, EventOnAnyKey, 0); - if (in.key.keycode != 'Y') return; - - delete_file_base(app, file_name, buffer.buffer_id); + if (start_query_bar(app, &bar, 0) != 0){ + User_Input in = get_user_input(app, EventOnAnyKey, 0); + if (in.key.keycode == 'Y'){ + delete_file_base(app, file_name, buffer); + } + } } + end_temp_memory(temp); } CUSTOM_COMMAND_SIG(save_to_query) CUSTOM_DOC("Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.") { View_Summary view = get_active_view(app, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessAll); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessAll, &buffer); + + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + String buffer_name = buffer_push_unique_buffer_name(app, buffer, scratch); // Query the user - Query_Bar bar; - + Query_Bar bar = {}; char prompt_space[4096]; bar.prompt = make_fixed_width_string(prompt_space); append(&bar.prompt, "Save '"); - append(&bar.prompt, make_string(buffer.buffer_name, buffer.buffer_name_len)); + append(&bar.prompt, buffer_name); append(&bar.prompt, "' to: "); char name_space[4096]; bar.string = make_fixed_width_string(name_space); - if (!query_user_string(app, &bar)) return; - if (bar.string.size == 0) return; - - char new_file_name_space[4096]; - String new_file_name = make_fixed_width_string(new_file_name_space); - i32 hot_dir_size = directory_get_hot(app, 0, 0); - if (new_file_name.size + hot_dir_size <= new_file_name.memory_size){ - new_file_name.size += directory_get_hot(app, new_file_name.str + new_file_name.size, new_file_name.memory_size - new_file_name.size); - //append(&new_file_name, "/"); - if (append(&new_file_name, bar.string)){ - if (save_buffer(app, &buffer, new_file_name.str, new_file_name.size, BufferSave_IgnoreDirtyFlag)){ - Buffer_Summary new_buffer = create_buffer(app, new_file_name.str, new_file_name.size, BufferCreate_NeverNew|BufferCreate_JustChangedFile); - if (new_buffer.exists){ - if (new_buffer.buffer_id != buffer.buffer_id){ - kill_buffer(app, buffer_identifier(buffer.buffer_id), 0, BufferKill_AlwaysKill); - view_set_buffer(app, &view, new_buffer.buffer_id, 0); + if (query_user_string(app, &bar)){ + if (bar.string.size != 0){ + char new_file_name_space[4096]; + String new_file_name = make_fixed_width_string(new_file_name_space); + i32 hot_dir_size = directory_get_hot(app, 0, 0); + if (new_file_name.size + hot_dir_size <= new_file_name.memory_size){ + new_file_name.size += directory_get_hot(app, new_file_name.str + new_file_name.size, new_file_name.memory_size - new_file_name.size); + if (append(&new_file_name, bar.string)){ + if (buffer_save(app, buffer, new_file_name, BufferSave_IgnoreDirtyFlag)){ + Buffer_ID new_buffer = 0; + create_buffer(app, new_file_name, BufferCreate_NeverNew|BufferCreate_JustChangedFile, &new_buffer); + if (new_buffer != 0 && new_buffer != buffer){ + kill_buffer(app, buffer_identifier(buffer), 0, BufferKill_AlwaysKill); + view_set_buffer(app, &view, new_buffer, 0); + } } } } } } + + end_temp_memory(temp); } CUSTOM_COMMAND_SIG(rename_file_query) CUSTOM_DOC("Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.") { View_Summary view = get_active_view(app, AccessAll); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessAll); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessAll, &buffer); - if (buffer.file_name != 0){ - char file_name_space[4096]; - String file_name = make_fixed_width_string(file_name_space); - if (copy_checked(&file_name, make_string(buffer.file_name, buffer.file_name_len))){ - // Query the user - Query_Bar bar; - - char prompt_space[4096]; - bar.prompt = make_fixed_width_string(prompt_space); - append(&bar.prompt, "Rename '"); - append(&bar.prompt, front_of_directory(file_name)); - append(&bar.prompt, "' to: "); - - char name_space[4096]; - bar.string = make_fixed_width_string(name_space); - if (!query_user_string(app, &bar)) return; - if (bar.string.size == 0) return; - - // TODO(allen): There should be a way to say, "detach a buffer's file" and "attach this file to a buffer" - - char new_file_name_space[4096]; - String new_file_name = make_fixed_width_string(new_file_name_space); - copy(&new_file_name, file_name); - remove_last_folder(&new_file_name); - append(&new_file_name, bar.string); - terminate_with_null(&new_file_name); - - if (save_buffer(app, &buffer, new_file_name.str, new_file_name.size, BufferSave_IgnoreDirtyFlag)){ - Buffer_Summary new_buffer = create_buffer(app, new_file_name.str, new_file_name.size, BufferCreate_NeverNew|BufferCreate_JustChangedFile); - if (new_buffer.exists && new_buffer.buffer_id != buffer.buffer_id){ - delete_file_base(app, file_name, buffer.buffer_id); - view_set_buffer(app, &view, new_buffer.buffer_id, 0); + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + + String file_name = buffer_push_file_name(app, buffer, scratch);; + + if (file_name.size > 0){ + // Query the user + Query_Bar bar = {}; + + char prompt_space[4096]; + bar.prompt = make_fixed_width_string(prompt_space); + append(&bar.prompt, "Rename '"); + append(&bar.prompt, front_of_directory(file_name)); + append(&bar.prompt, "' to: "); + + char name_space[4096]; + bar.string = make_fixed_width_string(name_space); + if (query_user_string(app, &bar)){ + if (bar.string.size != 0){ + // TODO(allen): There should be a way to say, "detach a buffer's file" and "attach this file to a buffer" + char new_file_name_space[4096]; + String new_file_name = make_fixed_width_string(new_file_name_space); + copy(&new_file_name, file_name); + remove_last_folder(&new_file_name); + append(&new_file_name, bar.string); + terminate_with_null(&new_file_name); + + if (buffer_save(app, buffer, new_file_name, BufferSave_IgnoreDirtyFlag)){ + Buffer_ID new_buffer = 0; + create_buffer(app, new_file_name, BufferCreate_NeverNew|BufferCreate_JustChangedFile, &new_buffer); + if (new_buffer != 0 && new_buffer != buffer){ + delete_file_base(app, file_name, buffer); + view_set_buffer(app, &view, new_buffer, 0); + } } } } + } + + end_temp_memory(temp); } CUSTOM_COMMAND_SIG(make_directory_query) @@ -1335,63 +1353,58 @@ CUSTOM_COMMAND_SIG(move_line_up) CUSTOM_DOC("Swaps the line under the cursor with the line above it, and moves the cursor up with it.") { View_Summary view = get_active_view(app, AccessOpen); - - if (view.cursor.line <= 1){ - return; - } - - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - if (!buffer.exists){ - return; - } - - Full_Cursor prev_line_cursor = {}; - Full_Cursor this_line_cursor = {}; - Full_Cursor next_line_cursor = {}; - - i32 this_line = view.cursor.line; - i32 prev_line = this_line - 1; - i32 next_line = this_line +1; - - if (view_compute_cursor(app, &view, seek_line_char(prev_line, 1), &prev_line_cursor) && - view_compute_cursor(app, &view, seek_line_char(this_line, 1), &this_line_cursor) && - view_compute_cursor(app, &view, seek_line_char(next_line, 1), &next_line_cursor)){ - - i32 prev_line_pos = prev_line_cursor.pos; - i32 this_line_pos = this_line_cursor.pos; - i32 next_line_pos = next_line_cursor.pos; - - Partition *part = &global_part; - Temp_Memory temp = begin_temp_memory(part); - - i32 length = next_line_pos - prev_line_pos; - char *swap = push_array(part, char, length + 1); - i32 first_len = next_line_pos - this_line_pos; - - if (buffer_read_range(app, &buffer, this_line_pos, next_line_pos, swap)){ - b32 second_line_didnt_have_newline = true; - for (i32 i = first_len - 1; i >= 0; --i){ - if (swap[i] == '\n'){ - second_line_didnt_have_newline = false; - break; + if (view.cursor.line > 1){ + Buffer_ID buffer = 0; + if (view_get_buffer(app, view.view_id, AccessOpen, &buffer)){ + Full_Cursor prev_line_cursor = {}; + Full_Cursor this_line_cursor = {}; + Full_Cursor next_line_cursor = {}; + + i32 this_line = view.cursor.line; + i32 prev_line = this_line - 1; + i32 next_line = this_line + 1; + + if (view_compute_cursor(app, &view, seek_line_char(prev_line, 1), &prev_line_cursor) && + view_compute_cursor(app, &view, seek_line_char(this_line, 1), &this_line_cursor) && + view_compute_cursor(app, &view, seek_line_char(next_line, 1), &next_line_cursor)){ + + i32 prev_line_pos = prev_line_cursor.pos; + i32 this_line_pos = this_line_cursor.pos; + i32 next_line_pos = next_line_cursor.pos; + + Partition *part = &global_part; + Temp_Memory temp = begin_temp_memory(part); + + i32 length = next_line_pos - prev_line_pos; + char *swap = push_array(part, char, length + 1); + i32 first_len = next_line_pos - this_line_pos; + + if (buffer_read_range(app, buffer, this_line_pos, next_line_pos, swap)){ + b32 second_line_didnt_have_newline = true; + for (i32 i = first_len - 1; i >= 0; --i){ + if (swap[i] == '\n'){ + second_line_didnt_have_newline = false; + break; + } + } + + if (second_line_didnt_have_newline){ + swap[first_len] = '\n'; + first_len += 1; + // NOTE(allen): Don't increase "length" because then we will be including + // the original newline and addignt this new one, making the file longer + // which shouldn't be possible for this command! + } + + if (buffer_read_range(app, buffer, prev_line_pos, this_line_pos, swap + first_len)){ + buffer_replace_range(app, buffer, prev_line_pos, next_line_pos, make_string(swap, length)); + view_set_cursor(app, &view, seek_line_char(prev_line, 1), true); + } } - } - - if (second_line_didnt_have_newline){ - swap[first_len] = '\n'; - first_len += 1; - // NOTE(allen): Don't increase "length" because then we will be including - // the original newline and addignt this new one, making the file longer - // which shouldn't be possible for this command! - } - - if (buffer_read_range(app, &buffer, prev_line_pos, this_line_pos, swap + first_len)){ - buffer_replace_range(app, &buffer, prev_line_pos, next_line_pos, swap, length); - view_set_cursor(app, &view, seek_line_char(prev_line, 1), true); + + end_temp_memory(temp); } } - - end_temp_memory(temp); } } @@ -1399,21 +1412,15 @@ CUSTOM_COMMAND_SIG(move_line_down) CUSTOM_DOC("Swaps the line under the cursor with the line below it, and moves the cursor down with it.") { View_Summary view = get_active_view(app, AccessOpen); - if (!view.exists){ - return; - } - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - if (!buffer.exists){ - return; - } - - i32 next_line = view.cursor.line + 1; - Full_Cursor new_cursor = {}; - if (view_compute_cursor(app, &view, seek_line_char(next_line, 1), &new_cursor)){ - if (new_cursor.line == next_line){ - view_set_cursor(app, &view, seek_pos(new_cursor.pos), true); - move_line_up(app); - move_down_textual(app); + if (view.exists){ + i32 next_line = view.cursor.line + 1; + Full_Cursor new_cursor = {}; + if (view_compute_cursor(app, &view, seek_line_char(next_line, 1), &new_cursor)){ + if (new_cursor.line == next_line){ + view_set_cursor(app, &view, seek_pos(new_cursor.pos), true); + move_line_up(app); + move_down_textual(app); + } } } } @@ -1636,16 +1643,22 @@ CUSTOM_COMMAND_SIG(save) CUSTOM_DOC("Saves the current buffer.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - save_buffer(app, &buffer, buffer.file_name, buffer.file_name_len, 0); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + String file_name = buffer_push_file_name(app, buffer, scratch); + buffer_save(app, buffer, file_name, 0); + end_temp_memory(temp); } CUSTOM_COMMAND_SIG(reopen) CUSTOM_DOC("Reopen the current buffer from the hard drive.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - reopen_buffer(app, &buffer, 0); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); + buffer_reopen(app, buffer, 0, 0); } //////////////////////////////// @@ -1702,6 +1715,7 @@ record_get_new_cursor_position_redo(Application_Links *app, Buffer_ID buffer_id, return(record_get_new_cursor_position_redo(app, buffer_id, index, record)); } +// TODO(allen): switch to this being the default CUSTOM_COMMAND_SIG(undo_this_buffer) CUSTOM_DOC("Advances backwards through the undo history of the current buffer.") { @@ -1716,6 +1730,7 @@ CUSTOM_DOC("Advances backwards through the undo history of the current buffer.") } } +// TODO(allen): switch to this being the default CUSTOM_COMMAND_SIG(redo_this_buffer) CUSTOM_DOC("Advances forwards through the undo history of the current buffer.") { @@ -1741,22 +1756,23 @@ CUSTOM_DOC("Advances backward through the undo history in the buffer containing Buffer_ID last_buffer_match = 0; i32 match_count = 0; - for (Buffer_Summary buffer = get_buffer_first(app, AccessAll); - buffer.exists; - get_buffer_next(app, &buffer, AccessAll)){ + Buffer_ID buffer = 0; + for (get_buffer_next(app, 0, AccessAll, &buffer); + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ History_Record_Index index = 0; - buffer_history_get_current_state_index(app, buffer.buffer_id, &index); + buffer_history_get_current_state_index(app, buffer, &index); if (index > 0){ Record_Info record = {}; - buffer_history_get_record_info(app, buffer.buffer_id, index, &record); + buffer_history_get_record_info(app, buffer, index, &record); if (record.edit_number > highest_edit_number){ highest_edit_number = record.edit_number; - first_buffer_match = buffer.buffer_id; - last_buffer_match = buffer.buffer_id; + first_buffer_match = buffer; + last_buffer_match = buffer; match_count = 1; } else if (record.edit_number == highest_edit_number){ - last_buffer_match = buffer.buffer_id; + last_buffer_match = buffer; match_count += 1; } } @@ -1768,21 +1784,21 @@ CUSTOM_DOC("Advances backward through the undo history in the buffer containing match_count = 0; if (highest_edit_number != -1){ - for (Buffer_Summary buffer = get_buffer(app, first_buffer_match, AccessAll); - buffer.exists; - get_buffer_next(app, &buffer, AccessAll)){ + for (Buffer_ID buffer = first_buffer_match; + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ b32 did_match = false; i32 new_edit_position = 0; for (;;){ History_Record_Index index = 0; - buffer_history_get_current_state_index(app, buffer.buffer_id, &index); + buffer_history_get_current_state_index(app, buffer, &index); if (index > 0){ Record_Info record = {}; - buffer_history_get_record_info(app, buffer.buffer_id, index, &record); + buffer_history_get_record_info(app, buffer, index, &record); if (record.edit_number == highest_edit_number){ did_match = true; - new_edit_position = record_get_new_cursor_position_undo(app, buffer.buffer_id, index, record); - buffer_history_set_current_state_index(app, buffer.buffer_id, index - 1); + new_edit_position = record_get_new_cursor_position_undo(app, buffer, index, record); + buffer_history_set_current_state_index(app, buffer, index - 1); } else{ break; @@ -1793,11 +1809,11 @@ CUSTOM_DOC("Advances backward through the undo history in the buffer containing } } if (did_match){ - match_buffers[match_count] = buffer.buffer_id; + match_buffers[match_count] = buffer; new_positions[match_count] = new_edit_position; match_count += 1; } - if (buffer.buffer_id == last_buffer_match){ + if (buffer == last_buffer_match){ break; } } @@ -1817,24 +1833,25 @@ CUSTOM_DOC("Advances forward through the undo history in the buffer containing t Buffer_ID last_buffer_match = 0; i32 match_count = 0; - for (Buffer_Summary buffer = get_buffer_first(app, AccessAll); - buffer.exists; - get_buffer_next(app, &buffer, AccessAll)){ + Buffer_ID buffer = 0; + for (get_buffer_next(app, 0, AccessAll, &buffer); + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ History_Record_Index max_index = 0; History_Record_Index index = 0; - buffer_history_get_max_record_index(app, buffer.buffer_id, &max_index); - buffer_history_get_current_state_index(app, buffer.buffer_id, &index); + buffer_history_get_max_record_index(app, buffer, &max_index); + buffer_history_get_current_state_index(app, buffer, &index); if (index < max_index){ Record_Info record = {}; - buffer_history_get_record_info(app, buffer.buffer_id, index + 1, &record); + buffer_history_get_record_info(app, buffer, index + 1, &record); if (record.edit_number < lowest_edit_number){ lowest_edit_number = record.edit_number; - first_buffer_match = buffer.buffer_id; - last_buffer_match = buffer.buffer_id; + first_buffer_match = buffer; + last_buffer_match = buffer; match_count = 1; } else if (record.edit_number == lowest_edit_number){ - last_buffer_match = buffer.buffer_id; + last_buffer_match = buffer; match_count += 1; } } @@ -1846,23 +1863,23 @@ CUSTOM_DOC("Advances forward through the undo history in the buffer containing t match_count = 0; if (lowest_edit_number != -1){ - for (Buffer_Summary buffer = get_buffer(app, first_buffer_match, AccessAll); - buffer.exists; - get_buffer_next(app, &buffer, AccessAll)){ + for (Buffer_ID buffer = first_buffer_match; + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ b32 did_match = false; i32 new_edit_position = 0; History_Record_Index max_index = 0; - buffer_history_get_max_record_index(app, buffer.buffer_id, &max_index); + buffer_history_get_max_record_index(app, buffer, &max_index); for (;;){ History_Record_Index index = 0; - buffer_history_get_current_state_index(app, buffer.buffer_id, &index); + buffer_history_get_current_state_index(app, buffer, &index); if (index < max_index){ Record_Info record = {}; - buffer_history_get_record_info(app, buffer.buffer_id, index + 1, &record); + buffer_history_get_record_info(app, buffer, index + 1, &record); if (record.edit_number == lowest_edit_number){ did_match = true; - new_edit_position = record_get_new_cursor_position_redo(app, buffer.buffer_id, index + 1, record); - buffer_history_set_current_state_index(app, buffer.buffer_id, index + 1); + new_edit_position = record_get_new_cursor_position_redo(app, buffer, index + 1, record); + buffer_history_set_current_state_index(app, buffer, index + 1); } else{ break; @@ -1873,11 +1890,11 @@ CUSTOM_DOC("Advances forward through the undo history in the buffer containing t } } if (did_match){ - match_buffers[match_count] = buffer.buffer_id; + match_buffers[match_count] = buffer; new_positions[match_count] = new_edit_position; match_count += 1; } - if (buffer.buffer_id == last_buffer_match){ + if (buffer == last_buffer_match){ break; } } diff --git a/4coder_base_types.cpp b/4coder_base_types.cpp index 56039428..79d4a836 100644 --- a/4coder_base_types.cpp +++ b/4coder_base_types.cpp @@ -870,7 +870,7 @@ rectify(Range range) { static b32 interval_overlap(i32 a0, i32 a1, i32 b0, i32 b1){ - return(!(a1 < b0 || b1 < a0)); + return(a0 < b1 && b0 < a1); } static b32 @@ -878,6 +878,11 @@ interval_overlap(Range a, Range b){ return(interval_overlap(a.first, a.one_past_last, b.first, b.one_past_last)); } +static i32 +interval_overlap(f32 a0, f32 a1, f32 b0, f32 b1){ + return(a0 < b1 && b0 < a1); +} + static b32 interval_contains(i32 a0, i32 a1, i32 b){ return((a0 <= b) && (b < a1)); @@ -888,6 +893,18 @@ interval_contains(Range range, i32 b){ return(interval_contains(range.start, range.one_past_last, b)); } +static Range +clip_range_to_width(Range range, i32 max_width) { + i32 top = range.first + max_width; + range.end = clamp_top(range.end, top); + return(range); +} + +static b32 +interval_is_valid(Range range){ + return(range.start <= range.one_past_last); +} + //////////////////////////////// static i32_Rect @@ -949,33 +966,23 @@ rect_equal(i32_Rect r1, i32_Rect r2){ } static b32 -hit_check(f32 x, f32 y, f32 x0, f32 y0, f32 x1, f32 y1){ - return(x >= x0 && x < x1 && y >= y0 && y < y1); +rect_contains_point(b32 BLAH, f32 x0, f32 y0, f32 x1, f32 y1, f32 x, f32 y){ + return(x0 <= x && x < x1 && y0 <= y && y < y1); } static b32 -hit_check(f32 x, f32 y, f32_Rect rect){ - return(hit_check(x, y, rect.x0, rect.y0, rect.x1, rect.y1)); +rect_contains_point(b32 BLAH, i32 x0, i32 y0, i32 x1, i32 y1, i32 x, i32 y){ + return(x0 <= x && x < x1 && y0 <= y && y < y1); } static b32 -hit_check(Rect_f32 rect, Vec2_f32 p){ - return(hit_check(p.x, p.y, rect.x0, rect.y0, rect.x1, rect.y1)); +rect_contains_point(Rect_f32 rect, Vec2_f32 p){ + return(rect_contains_point(false, rect.x0, rect.y0, rect.x1, rect.y1, p.x, p.y)); } static b32 -hit_check(i32 x, i32 y, i32 x0, i32 y0, i32 x1, i32 y1){ - return(x >= x0 && x < x1 && y >= y0 && y < y1); -} - -static b32 -hit_check(i32 x, i32 y, i32_Rect rect){ - return(hit_check(x, y, rect.x0, rect.y0, rect.x1, rect.y1)); -} - -static b32 -hit_check(Rect_i32 rect, Vec2_i32 p){ - return(hit_check(p.x, p.y, rect.x0, rect.y0, rect.x1, rect.y1)); +rect_contains_point(Rect_i32 rect, Vec2_i32 p){ + return(rect_contains_point(false, rect.x0, rect.y0, rect.x1, rect.y1, p.x, p.y)); } static i32_Rect @@ -1013,11 +1020,6 @@ fits_inside(i32_Rect rect, i32_Rect outer){ return(rect.x0 >= outer.x0 && rect.x1 <= outer.x1 && rect.y0 >= outer.y0 && rect.y1 <= outer.y1); } -static i32 -interval_overlap(f32 a0, f32 a1, f32 b0, f32 b1){ - return(a0 < b1 && b0 < a1); -} - static i32 rect_overlap(f32_Rect a, f32_Rect b){ return(interval_overlap(a.x0, a.x1, b.x0, b.x1) && @@ -1039,6 +1041,13 @@ rect_dim(f32_Rect rect){ return(V2(rect.x1 - rect.x0, rect.y1 - rect.y0)); } +static Vec2 +rect_center(f32_Rect rect){ + return(V2(0.5f*(rect.x0 + rect.x1), 0.5f*(rect.y0 + rect.y1))); +} + +#define center_of rect_center + static i32_Rect intersection_of(i32_Rect a, i32_Rect b) { diff --git a/4coder_base_types.h b/4coder_base_types.h index b3778f01..c914fe1e 100644 --- a/4coder_base_types.h +++ b/4coder_base_types.h @@ -428,6 +428,21 @@ struct f32_Rect_Pair typedef f32_Rect_Pair Rect_f32_Pair; +typedef i32 Coordinate; +typedef i32 Side; + +enum{ + Coordinate_X = 0, + Coordinate_Y = 1, + Coordinate_Z = 2, + Coordinate_W = 3, +}; + +enum{ + Side_Min = 0, + Side_Max = 1, +}; + #endif // BOTTOM diff --git a/4coder_build_commands.cpp b/4coder_build_commands.cpp index a82e9e31..dd8832d8 100644 --- a/4coder_build_commands.cpp +++ b/4coder_build_commands.cpp @@ -12,36 +12,36 @@ // There is no requirement that a custom build system in 4coder actually use the // directory given by this function. static i32 -get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_out){ +get_build_directory(Application_Links *app, Buffer_ID buffer, String *dir_out){ + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + i32 result = BuildDir_None; - if (buffer != 0 && buffer->file_name != 0){ - if (!match_cc(buffer->file_name, buffer->buffer_name)){ - char *file_name = buffer->file_name; - i32 file_name_len = buffer->file_name_len; - String dir = make_string_cap(file_name, file_name_len, file_name_len+1); - remove_last_folder(&dir); - append_ss(dir_out, dir); + if (buffer != 0){ + String file_name = buffer_push_file_name(app, buffer, scratch); + String base_name = buffer_push_base_buffer_name(app, buffer, scratch); + if (!match(file_name, base_name)){ + remove_last_folder(&file_name); + append(dir_out, file_name); result = BuildDir_AtFile; } } - if (!result){ - i32 len = directory_get_hot(app, dir_out->str, - dir_out->memory_size - dir_out->size); - if (dir_out->size + len < dir_out->memory_size){ - dir_out->size += len; + if (result == BuildDir_None){ + if (get_hot_directory(app, dir_out, 0)){ result = BuildDir_AtHot; } } + end_temp_memory(temp); + return(result); } // TODO(allen): Better names for the "standard build search" family. static i32 -standard_build_search(Application_Links *app, View_Summary *view, Buffer_Summary *active_buffer, - String *dir, String *command, b32 perform_backup, b32 use_path_in_command, String filename, String command_name){ +standard_build_search(Application_Links *app, View_Summary *view, String *dir, String *command, b32 perform_backup, b32 use_path_in_command, String filename, String command_name){ i32 result = false; for(;;){ @@ -98,10 +98,8 @@ standard_build_search(Application_Links *app, View_Summary *view, Buffer_Summary // NOTE(allen): Build search rule for windows. static i32 -execute_standard_build_search(Application_Links *app, View_Summary *view, - Buffer_Summary *active_buffer, - String *dir, String *command, i32 perform_backup){ - i32 result = standard_build_search(app, view, active_buffer, dir, command, perform_backup, true, make_lit_string("build.bat"), make_lit_string("build")); +execute_standard_build_search(Application_Links *app, View_Summary *view, String *dir, String *command, i32 perform_backup){ + i32 result = standard_build_search(app, view, dir, command, perform_backup, true, make_lit_string("build.bat"), make_lit_string("build")); return(result); } @@ -109,17 +107,14 @@ execute_standard_build_search(Application_Links *app, View_Summary *view, // NOTE(allen): Build search rule for linux and mac. static i32 -execute_standard_build_search(Application_Links *app, View_Summary *view, Buffer_Summary *active_buffer, String *dir, String *command, b32 perform_backup){ +execute_standard_build_search(Application_Links *app, View_Summary *view, String *dir, String *command, b32 perform_backup){ char dir_space[512]; String dir_copy = make_fixed_width_string(dir_space); copy(&dir_copy, *dir); - - i32 result = standard_build_search(app, view, active_buffer, dir, command, 0, 1, make_lit_string("build.sh"), make_lit_string("build.sh")); - + i32 result = standard_build_search(app, view, dir, command, 0, 1, make_lit_string("build.sh"), make_lit_string("build.sh")); if (!result){ - result = standard_build_search(app, view, active_buffer, &dir_copy, command, perform_backup, 0, make_lit_string("Makefile"), make_lit_string("make")); + result = standard_build_search(app, view, &dir_copy, command, perform_backup, 0, make_lit_string("Makefile"), make_lit_string("make")); } - return(result); } @@ -130,47 +125,44 @@ execute_standard_build_search(Application_Links *app, View_Summary *view, Buffer // NOTE(allen): This searches first using the active file's directory, // then if no build script is found, it searches from 4coders hot directory. static void -execute_standard_build(Application_Links *app, View_Summary *view, Buffer_Summary *active_buffer){ +execute_standard_build(Application_Links *app, View_Summary *view, Buffer_ID active_buffer){ char dir_space[512]; String dir = make_fixed_width_string(dir_space); - char command_str_space[512]; String command = make_fixed_width_string(command_str_space); - i32 build_dir_type = get_build_directory(app, active_buffer, &dir); - if (build_dir_type == BuildDir_AtFile){ - if (!execute_standard_build_search(app, view, active_buffer, &dir, &command, false)){ + if (!execute_standard_build_search(app, view, &dir, &command, false)){ dir.size = 0; command.size = 0; build_dir_type = get_build_directory(app, 0, &dir); } } - if (build_dir_type == BuildDir_AtHot){ - execute_standard_build_search(app, view, active_buffer, &dir, &command, true); + execute_standard_build_search(app, view, &dir, &command, true); } } CUSTOM_COMMAND_SIG(build_search) CUSTOM_DOC("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*.") { - u32 access = AccessAll; - View_Summary view = get_active_view(app, access); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); - execute_standard_build(app, &view, &buffer); + View_Summary view = get_active_view(app, AccessAll); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessAll, &buffer); + execute_standard_build(app, &view, buffer); memset(&prev_location, 0, sizeof(prev_location)); - lock_jump_buffer(literal("*compilation*")); + lock_jump_buffer(make_lit_string("*compilation*")); } -#define GET_COMP_BUFFER(app) get_buffer_by_name(app, literal("*compilation*"), AccessAll) +#define GET_COMP_BUFFER(app,id) get_buffer_by_name(app, make_lit_string("*compilation*"), AccessAll, (id)) static View_Summary get_or_open_build_panel(Application_Links *app){ View_Summary view = {}; - Buffer_Summary buffer = GET_COMP_BUFFER(app); - if (buffer.exists){ - view = get_first_view_with_buffer(app, buffer.buffer_id); + Buffer_ID buffer = 0; + GET_COMP_BUFFER(app, &buffer); + if (buffer != 0){ + view = get_first_view_with_buffer(app, buffer); } if (!view.exists){ view = open_build_footer_panel(app); @@ -180,24 +172,25 @@ get_or_open_build_panel(Application_Links *app){ static void set_fancy_compilation_buffer_font(Application_Links *app){ - Buffer_Summary comp_buffer = GET_COMP_BUFFER(app); - set_buffer_face_by_name(app, &comp_buffer, literal("Inconsolata")); + Buffer_ID buffer = 0; + GET_COMP_BUFFER(app, &buffer); + set_buffer_face_by_name(app, buffer, literal("Inconsolata")); } CUSTOM_COMMAND_SIG(build_in_build_panel) CUSTOM_DOC("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.") { - u32 access = AccessAll; - View_Summary view = get_active_view(app, access); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + View_Summary view = get_active_view(app, AccessAll); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessAll, &buffer); View_Summary build_view = get_or_open_build_panel(app); - execute_standard_build(app, &build_view, &buffer); + execute_standard_build(app, &build_view, buffer); set_fancy_compilation_buffer_font(app); memset(&prev_location, 0, sizeof(prev_location)); - lock_jump_buffer(literal("*compilation*")); + lock_jump_buffer(make_lit_string("*compilation*")); } CUSTOM_COMMAND_SIG(close_build_panel) diff --git a/4coder_casey_pending.cpp b/4coder_casey_pending.cpp deleted file mode 100644 index db40874b..00000000 --- a/4coder_casey_pending.cpp +++ /dev/null @@ -1,510 +0,0 @@ -/* ======================================================================== -$File: work/apps/4coder/custom/4coder_casey_pending.cpp $ -$Date: 2019/03/30 23:57:38 UTC $ -$Revision: 21 $ -$Creator: Casey Muratori $ -$Notice: (C) Copyright by Molly Rocket, Inc., All Rights Reserved. $ -======================================================================== */ - -/* NOTE(casey): - -Allen, this is a file full of things that I think 4coder should have provided natively, so unless there's something objectionable -about them, I think they could be merged? - -*/ - -#include - -static Range -clip_range_to_width(Range range, int32_t max_width) { - Range result = range; - if((result.start + max_width) < result.end) { - result.end = result.start + max_width; - } - - return(result); -} - -#define CStrCase(a) case a: return(#a) -#define StringCase(a) case a: return(make_lit_string(#a)) - -// TODO(casey): Merge this with Allen's Token_Iterator when it's ready? -struct token_iterator -{ - Buffer_ID buffer; - bool32 valid; - int32_t index; -}; - -#if 0 -static void -Append(Found_String_List *dest, Found_String_List source) -{ - if(dest->last) - { - dest->last->next = source.first; - dest->last = source.last; - dest->count += source.count; - } - else - { - *dest = source; - } -} -#endif - -static Vec2 -center_of(f32_Rect a) -{ - Vec2 result; - - result.x = 0.5f*(a.x0 + a.x1); - result.y = 0.5f*(a.y0 + a.y1); - - return(result); -} - -static f32_Rect -f32_rect_from(i32_Rect a) -{ - f32_Rect result; - - result.x0 = (float)a.x0; - result.x1 = (float)a.x1; - result.y0 = (float)a.y0; - result.y1 = (float)a.y1; - - return(result); -} - -static i32_Rect -i32_rect_from(f32_Rect a) -{ - i32_Rect result; - - result.x0 = round32(a.x0); - result.x1 = round32(a.x1); - result.y0 = round32(a.y0); - result.y1 = round32(a.y1); - - return(result); -} - -static bool32 -is_valid(Range range) -{ - bool32 result = (range.start < range.one_past_last); - return(result); -} - -static bool32 -is_in(f32_Rect a, Vec2 p) -{ - bool32 result = ((p.x >= a.x0) && - (p.x < a.x1) && - (p.y >= a.y0) && - (p.y < a.y1)); - return(result); -} - -static bool32 -is_visible(View_Summary *view, Vec2 p) -{ - bool32 result = is_in(f32_rect_from(view->render_region), p); - return(result); -} - -static token_iterator -iterate_tokens(Application_Links *app, Buffer_ID buffer, int32_t absolute_position) -{ - token_iterator iter = {}; - - iter.buffer = buffer; - - Cpp_Get_Token_Result temp; - iter.valid = buffer_get_token_index(app, buffer, absolute_position, &temp); - if(iter.valid) - { - iter.index = temp.token_index; - } - - return(iter); -} - -static Cpp_Token -get_next_token(Application_Links *app, token_iterator *iter) -{ - Cpp_Token result = {}; - - if(buffer_read_tokens(app, iter->buffer, iter->index, iter->index + 1, &result)) - { - ++iter->index; - } - else - { - iter->valid = false; - } - - return(result); -} - -static Cpp_Token -peek_token(Application_Links *app, token_iterator *iter) -{ - Cpp_Token result = {}; - - buffer_read_tokens(app, iter->buffer, iter->index, iter->index + 1, &result); - - return(result); -} - -static Cpp_Token -get_prev_token(Application_Links *app, token_iterator *iter) -{ - Cpp_Token result = {}; - - if(buffer_read_tokens(app, iter->buffer, iter->index, iter->index + 1, &result)) - { - --iter->index; - } - else - { - iter->valid = false; - } - - return(result); -} - -static String -scratch_read(Application_Links *app, Arena *scratch, Buffer_ID buffer, int32_t start, int32_t end) -{ - String result = {}; - - if(start <= end) - { - int32_t len = end - start; - result = push_string_space(scratch, len); - if(buffer_read_range(app, buffer, start, end, result.str)) - { - result.size = len; - } - } - - return(result); -} - -static String -scratch_read(Application_Links *app, Arena *scratch, Buffer_ID buffer, Range location) -{ - String result = scratch_read(app, scratch, buffer, location.start, location.one_past_last); - return(result); -} - -static String -scratch_read(Application_Links *app, Arena *scratch, Buffer_ID buffer, Cpp_Token token) -{ - String result = scratch_read(app, scratch, buffer, token.start, token.start + token.size); - return(result); -} - -static bool32 -token_text_is(Application_Links *app, Buffer_Summary *buffer, Cpp_Token token, String match) -{ - Scratch_Block scratch(app); - - String text = scratch_read(app, scratch, buffer->buffer_id, token.start, token.start + token.size); - bool32 result = (compare_ss(text, match) == 0); - - return(result); -} - -static Range -token_range_from_abs(Application_Links *app, Buffer_ID buffer, int32_t pos, bool32 favor_forward) -{ - Range result = {}; - - Cpp_Get_Token_Result get; - if(buffer_get_token_index(app, buffer, pos, &get)) - { - if(favor_forward && get.in_whitespace_after_token) - { - Cpp_Token token; - buffer_read_tokens(app, buffer, get.token_index + 1, get.token_index + 2, &token); - result = make_range(token.start, token.start + token.size); - } - else - { - result = make_range(get.token_start, get.token_one_past_last); - } - } - - return(result); -} - -static int32_t -line_from_abs(Application_Links *app, Buffer_ID buffer, int32_t pos) -{ - int32_t Result = 0; - - Buffer_Seek seek = {}; - seek.type = buffer_seek_pos; - seek.pos = pos; - Partial_Cursor at; - if(buffer_compute_cursor(app, buffer, seek, &at)) - { - Result = at.line; - } - - return(Result); -} - -static i32 -abs_from_seek(Application_Links *app, Buffer_ID buffer, Buffer_Seek seek) -{ - i32 Result = 0; - - // TODO(casey): I feel like there need to be faster methods for round-tripping through the (column/line <-> pos) routes. - Partial_Cursor at; - if(buffer_compute_cursor(app, buffer, seek, &at)) - { - Result = at.pos; - } - - return(Result); -} - -static int32_t -line_from_abs(Application_Links *app, Buffer_Summary *buffer, int32_t pos) -{ - int32_t Result = 0; - - Buffer_Seek seek = {}; - seek.type = buffer_seek_pos; - seek.pos = pos; - Partial_Cursor at; - if(buffer_compute_cursor(app, buffer, seek, &at)) - { - Result = at.line; - } - - return(Result); -} - -static int32_t -line_from_abs(Application_Links *app, View_Summary *view, int32_t pos) -{ - int32_t Result = 0; - - Buffer_Seek seek = {}; - seek.type = buffer_seek_pos; - seek.pos = pos; - Full_Cursor at; - if(view_compute_cursor(app, view, seek, &at)) - { - Result = at.line; - } - - return(Result); -} - -static bool32 -cursor_from_abs(Application_Links *app, View_Summary *view, int32_t pos, Full_Cursor *cursor) -{ - Buffer_Seek seek = {}; - seek.type = buffer_seek_pos; - seek.pos = pos; - bool32 result = view_compute_cursor(app, view, seek, cursor); - return(result); -} - -// TODO(casey): Rename these now that they are "render space", not screen space -static Vec2 -screen_p_from(View_Summary *view, Full_Cursor *at) -{ - Vec2 Result = {}; - - Result.x = (float)at->wrapped_x - (float)view->scroll_vars.scroll_x; - Result.y = (float)at->wrapped_y - (float)view->scroll_vars.scroll_y; - - return(Result); -} - -static Vec2 -screen_p_from_abs(Application_Links *app, View_Summary *view, int32_t pos) -{ - Vec2 Result = {}; - - Full_Cursor at; - if(cursor_from_abs(app, view, pos, &at)) - { - Result = screen_p_from(view, &at); - } - - return(Result); -} - -static String -read_entire_file(Partition *arena, char *filename) -{ - String result = {}; - - FILE *file = fopen(filename, "rb"); - if(file) - { - fseek(file, 0, SEEK_END); - // TODO(casey): Can't we have 64-bit sized strings? :( - i32_4tech size = (i32_4tech)ftell(file); - fseek(file, 0, SEEK_SET); - - result = string_push(arena, (i32_4tech)size); - if(result.str) - { - result.size = size; - fread(result.str, result.size, 1, file); - } - - fclose(file); - } - - return(result); -} - -static void -draw_line(Application_Links *app, Vec2 from, Vec2 to, int_color color, float thickness) -{ - // TODO(casey): Allen, this should eventually be an actual line primitive, for non-rectangular lines - float half = 0.5f*thickness; - f32_Rect rect; - rect.x0 = Min(from.x, to.x) - half; - rect.x1 = Max(from.x, to.x) + half; - rect.y0 = Min(from.y, to.y) - half; - rect.y1 = Max(from.y, to.y) + half; - draw_rectangle(app, rect, color); -} - -static void -draw_line_loop(Application_Links *app, int32_t p_count, Vec2 *p, int_color color, float thickness) -{ - if(p_count) - { - int32_t prev = p_count - 1; - for(int32_t i = 0; i < p_count; ++i) - { - draw_line(app, p[prev], p[i], color, thickness); - prev = i; - } - } -} - -static float -get_dpi_scaling_value(Application_Links *app) -{ - // TODO(casey): Allen, this should return the multiplier for the display relative to whatever 4coder - // gets tuned to. - float result = 2.0f; - return(result); -} - -static f32_Rect -minkowski_sum(f32_Rect a, Vec2 b) -{ - f32_Rect r = a; - - r.x0 -= b.x; - r.x1 += b.x; - - r.x0 -= b.y; - r.x1 += b.y; - - return(r); -} - -static f32_Rect -minkowski_sum(f32_Rect a, f32 b) -{ - f32_Rect r = minkowski_sum(a, V2(b, b)); - - return(r); -} - -static void -clear_buffer(Application_Links *app, Buffer_ID buffer_id) -{ - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); - if(buffer.exists) - { - buffer_replace_range(app, buffer_id, 0, buffer.size, empty_string); - } -} - -static int32_t -get_end_of_line(Application_Links *app, Buffer_ID buffer, int32_t from) -{ - int32_t result = from; - - Partial_Cursor line; - if(buffer_compute_cursor(app, buffer, seek_pos(from), &line)) - { - Partial_Cursor eol; - if(buffer_compute_cursor(app, buffer, seek_line_char(line.line, max_i32), &eol)) - { - result = eol.pos; - } - } - - return(result); -} - -enum Coordinate -{ - Coordinate_X = 0, - Coordinate_Y = 1, -}; - -enum Side -{ - Side_Min = 0, - Side_Max = 1, -}; - -static f32_Rect_Pair -split_rect(f32_Rect rect, View_Split_Kind kind, Coordinate coord, Side from_side, f32 t) -{ - f32_Rect_Pair result; - - if(kind == ViewSplitKind_FixedPixels) - { - result.E[0] = rect; - result.E[1] = rect; - - if(coord == Coordinate_X) - { - result.E[0].x1 = (from_side == Side_Max) ? (rect.x1 - t) : (rect.x0 + t); - result.E[1].x0 = result.E[0].x1; - } - else - { - Assert(coord == Coordinate_Y); - result.E[0].y1 = (from_side == Side_Max) ? (rect.y1 - t) : (rect.y0 + t); - result.E[1].y0 = result.E[0].y1; - } - } - else - { - Assert(kind == ViewSplitKind_Ratio); - - f32 pixel_count; - if(coord == Coordinate_X) - { - pixel_count = t*(rect.x1 - rect.x0); - } - else - { - Assert(coord == Coordinate_Y); - pixel_count = t*(rect.y1 - rect.y0); - } - result = split_rect(rect, ViewSplitKind_FixedPixels, coord, from_side, pixel_count); - } - - return(result); -} diff --git a/4coder_clipboard.cpp b/4coder_clipboard.cpp index 15ca45ff..663a1a43 100644 --- a/4coder_clipboard.cpp +++ b/4coder_clipboard.cpp @@ -5,11 +5,11 @@ // TOP static b32 -post_buffer_range_to_clipboard(Application_Links *app, Partition *scratch, i32 clipboard_index, - Buffer_Summary *buffer, i32 first, i32 one_past_last){ +post_buffer_range_to_clipboard(Application_Links *app, Partition *scratch, i32 clipboard_index, Buffer_ID buffer, i32 first, i32 one_past_last){ b32 success = false; - if (buffer->exists && - 0 <= first && first < one_past_last && one_past_last <= buffer->size){ + i32 buffer_size = 0; + buffer_get_size(app, buffer, &buffer_size); + if (buffer != 0 && 0 <= first && first < one_past_last && one_past_last <= buffer_size){ Temp_Memory temp = begin_temp_memory(scratch); i32 size = one_past_last - first; char *str = push_array(scratch, char, size); @@ -27,31 +27,32 @@ CUSTOM_COMMAND_SIG(copy) CUSTOM_DOC("Copy the text in the range from the cursor to the mark onto the clipboard.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessProtected, &buffer); Range range = get_view_range(&view); - post_buffer_range_to_clipboard(app, &global_part, 0, &buffer, range.min, range.max); + post_buffer_range_to_clipboard(app, &global_part, 0, buffer, range.min, range.max); } CUSTOM_COMMAND_SIG(cut) CUSTOM_DOC("Cut the text in the range from the cursor to the mark onto the clipboard.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Range range = get_view_range(&view); - if (post_buffer_range_to_clipboard(app, &global_part, 0, &buffer, range.min, range.max)){ - buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); + if (post_buffer_range_to_clipboard(app, &global_part, 0, buffer, range.min, range.max)){ + buffer_replace_range(app, buffer, range.min, range.max, make_lit_string("")); } } CUSTOM_COMMAND_SIG(paste) CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.") { - u32 access = AccessOpen; i32 count = clipboard_count(app, 0); if (count > 0){ - View_Summary view = get_active_view(app, access); + View_Summary view = get_active_view(app, AccessOpen); if_view_has_highlighted_range_delete_range(app, view.view_id); - view = get_view(app, view.view_id, access); + view = get_view(app, view.view_id, AccessOpen); Managed_Scope scope = view_get_managed_scope(app, view.view_id); managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste); @@ -67,9 +68,11 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.") if (str != 0){ clipboard_index(app, 0, paste_index, str, len); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + i32 pos = view.cursor.pos; - buffer_replace_range(app, &buffer, pos, pos, str, len); + buffer_replace_range(app, buffer, pos, pos, make_string(str, len)); view_set_mark(app, &view, seek_pos(pos)); view_set_cursor(app, &view, seek_pos(pos + len), true); @@ -85,10 +88,9 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.") CUSTOM_COMMAND_SIG(paste_next) CUSTOM_DOC("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.") { - u32 access = AccessOpen; i32 count = clipboard_count(app, 0); if (count > 0){ - View_Summary view = get_active_view(app, access); + View_Summary view = get_active_view(app, AccessOpen); Managed_Scope scope = view_get_managed_scope(app, view.view_id); no_mark_snap_to_cursor(app, scope); @@ -111,11 +113,13 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste if (str != 0){ clipboard_index(app, 0, paste_index, str, len); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + Range range = get_view_range(&view); i32 pos = range.min; - buffer_replace_range(app, &buffer, range.min, range.max, str, len); + buffer_replace_range(app, buffer, range.min, range.max, make_string(str, len)); view_set_cursor(app, &view, seek_pos(pos + len), true); // TODO(allen): Send this to all views. diff --git a/4coder_default_framework.cpp b/4coder_default_framework.cpp index 5b30c34c..cc58c85f 100644 --- a/4coder_default_framework.cpp +++ b/4coder_default_framework.cpp @@ -11,32 +11,34 @@ unlock_jump_buffer(void){ } static void -lock_jump_buffer(char *name, i32 size){ - if (size <= locked_buffer.memory_size){ - copy(&locked_buffer, make_string(name, size)); +lock_jump_buffer(String name){ + if (name.size < locked_buffer.memory_size){ + copy(&locked_buffer, name); } } static void -lock_jump_buffer(Buffer_Summary buffer){ - lock_jump_buffer(buffer.buffer_name, buffer.buffer_name_len); +lock_jump_buffer(char *name, i32 size){ + lock_jump_buffer(make_string(name, size)); } static void lock_jump_buffer(Application_Links *app, Buffer_ID buffer_id){ - Buffer_Summary buffer = {}; - if (get_buffer_summary(app, buffer_id, AccessAll, &buffer)){ - lock_jump_buffer(buffer.buffer_name, buffer.buffer_name_len); - } + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + String buffer_name = buffer_push_unique_buffer_name(app, buffer_id, scratch); + lock_jump_buffer(buffer_name); + end_temp_memory(temp); } static View_Summary get_view_for_locked_jump_buffer(Application_Links *app){ View_Summary view = {}; if (locked_buffer.size > 0){ - Buffer_Summary buffer = get_buffer_by_name(app, locked_buffer.str, locked_buffer.size, AccessAll); - if (buffer.exists){ - view = get_first_view_with_buffer(app, buffer.buffer_id); + Buffer_ID buffer = 0; + get_buffer_by_name(app, locked_buffer, AccessAll, &buffer); + if (buffer != 0){ + view = get_first_view_with_buffer(app, buffer); } else{ unlock_jump_buffer(); @@ -275,37 +277,40 @@ CUSTOM_DOC("Create a new panel by horizontally splitting the active panel.") static Buffer_ID create_or_switch_to_buffer_by_name(Application_Links *app, char *name, i32 name_length, View_Summary default_target_view){ - u32 access = AccessAll; - Buffer_Summary search_buffer = get_buffer_by_name(app, name, name_length, access); - - if (search_buffer.exists){ - buffer_set_setting(app, &search_buffer, BufferSetting_ReadOnly, true); + String name_string = make_string(name, name_length); + Buffer_ID search_buffer = 0; + get_buffer_by_name(app, name_string, AccessAll, &search_buffer); + if (search_buffer != 0){ + buffer_set_setting(app, search_buffer, BufferSetting_ReadOnly, true); View_Summary target_view = default_target_view; - View_Summary view_with_buffer_already_open = get_first_view_with_buffer(app, search_buffer.buffer_id); + View_Summary view_with_buffer_already_open = get_first_view_with_buffer(app, search_buffer); if (view_with_buffer_already_open.exists){ target_view = view_with_buffer_already_open; view_end_ui_mode(app, &target_view); } else{ - view_set_buffer(app, &target_view, search_buffer.buffer_id, 0); + view_set_buffer(app, &target_view, search_buffer, 0); } set_active_view(app, &target_view); - buffer_send_end_signal(app, &search_buffer); - buffer_replace_range(app, &search_buffer, 0, search_buffer.size, 0, 0); + i32 buffer_size = 0; + buffer_get_size(app, search_buffer, &buffer_size); + + buffer_send_end_signal(app, search_buffer); + buffer_replace_range(app, search_buffer, 0, buffer_size, make_lit_string("")); } else{ - search_buffer = create_buffer(app, name, name_length, BufferCreate_AlwaysNew); - buffer_set_setting(app, &search_buffer, BufferSetting_Unimportant, true); - buffer_set_setting(app, &search_buffer, BufferSetting_ReadOnly, true); - buffer_set_setting(app, &search_buffer, BufferSetting_WrapLine, false); - view_set_buffer(app, &default_target_view, search_buffer.buffer_id, 0); + create_buffer(app, name_string, BufferCreate_AlwaysNew, &search_buffer); + buffer_set_setting(app, search_buffer, BufferSetting_Unimportant, true); + buffer_set_setting(app, search_buffer, BufferSetting_ReadOnly, true); + buffer_set_setting(app, search_buffer, BufferSetting_WrapLine, false); + view_set_buffer(app, &default_target_view, search_buffer, 0); set_active_view(app, &default_target_view); } - return(search_buffer.buffer_id); + return(search_buffer); } //////////////////////////////// diff --git a/4coder_experiments.cpp b/4coder_experiments.cpp index 1985da45..e98181e0 100644 --- a/4coder_experiments.cpp +++ b/4coder_experiments.cpp @@ -27,7 +27,8 @@ CUSTOM_COMMAND_SIG(kill_rect) CUSTOM_DOC("Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); i32_Rect rect = get_line_x_rect(&view); @@ -37,7 +38,7 @@ CUSTOM_DOC("Delete characters in a rectangular region. Range testing is done by i32 start = 0; i32 end = 0; - b32 success = 1; + b32 success = true; Full_Cursor cursor = {}; float y = get_line_y(app, &view, line); @@ -53,13 +54,13 @@ CUSTOM_DOC("Delete characters in a rectangular region. Range testing is done by end = cursor.pos; if (success){ - buffer_replace_range(app, &buffer, start, end, 0, 0); + buffer_replace_range(app, buffer, start, end, make_lit_string("")); } } } static void -pad_buffer_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, i32 line, char padchar, i32 target){ +pad_buffer_line(Application_Links *app, Partition *part, Buffer_ID buffer, i32 line, char padchar, i32 target){ Partial_Cursor start = {}; Partial_Cursor end = {}; @@ -68,10 +69,10 @@ pad_buffer_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, if (start.line == line){ if (end.character-1 < target){ Temp_Memory temp = begin_temp_memory(part); - i32 size = target - (end.character-1); + i32 size = target - (end.character - 1); char *str = push_array(part, char, size); memset(str, ' ', size); - buffer_replace_range(app, buffer, end.pos, end.pos, str, size); + buffer_replace_range(app, buffer, end.pos, end.pos, make_string(str, size)); end_temp_memory(temp); } } @@ -120,7 +121,8 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a Partition *part = &global_part; View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Buffer_Rect rect = get_rect(&view); @@ -128,7 +130,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a i32 pos = view.cursor.character-1; for (i32 i = rect.line0; i <= rect.line1; ++i){ - pad_buffer_line(app, &global_part, &buffer, i, ' ', pos); + pad_buffer_line(app, &global_part, buffer, i, ' ', pos); } i32 line_count = rect.line1 - rect.line0 + 1; @@ -147,7 +149,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a for (i32 i = rect.line0; i <= rect.line1; ++i){ Partial_Cursor cursor = {}; - if (buffer_compute_cursor(app, &buffer, seek_line_char(i, pos+1), &cursor)){ + if (buffer_compute_cursor(app, buffer, seek_line_char(i, pos + 1), &cursor)){ edit->str_start = 0; edit->len = 1; edit->start = cursor.pos; @@ -157,7 +159,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a } i32 edit_count = (int)(edit - edits); - buffer_batch_edit(app, &buffer, &str, 1, edits, edit_count, BatchEdit_Normal); + buffer_batch_edit(app, buffer, &str, 1, edits, edit_count, BatchEdit_Normal); end_temp_memory(temp); @@ -175,7 +177,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a for (i32 i = rect.line0; i <= rect.line1; ++i){ Partial_Cursor cursor = {}; - if (buffer_compute_cursor(app, &buffer, seek_line_char(i, pos+1), &cursor)){ + if (buffer_compute_cursor(app, buffer, seek_line_char(i, pos+1), &cursor)){ edit->str_start = 0; edit->len = 0; edit->start = cursor.pos-1; @@ -185,7 +187,7 @@ CUSTOM_DOC("Begin multi-line mode. In multi-line mode characters are inserted a } i32 edit_count = (int)(edit - edits); - buffer_batch_edit(app, &buffer, 0, 0, edits, edit_count, BatchEdit_Normal); + buffer_batch_edit(app, buffer, 0, 0, edits, edit_count, BatchEdit_Normal); end_temp_memory(temp); @@ -223,9 +225,10 @@ CUSTOM_COMMAND_SIG(multi_paste){ str[0] = '\n'; clipboard_index(app, 0, paste_index, str + 1, len); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Range range = get_view_range(&view); - buffer_replace_range(app, &buffer, range.max, range.max, str, len + 1); + buffer_replace_range(app, buffer, range.max, range.max, make_string(str, len + 1)); view_set_mark(app, &view, seek_pos(range.max + 1)); view_set_cursor(app, &view, seek_pos(range.max + len + 1), true); @@ -246,8 +249,8 @@ static Range multi_paste_range(Application_Links *app, View_Summary *view, Range range, i32 paste_count, b32 old_to_new){ Range finish_range = range; if (paste_count >= 1){ - Buffer_Summary buffer = get_buffer(app, view->buffer_id, AccessOpen); - if (buffer.exists){ + Buffer_ID buffer = 0; + if (view_get_buffer(app, view->view_id, AccessOpen, &buffer)){ i32 total_size = 0; for (i32 paste_index = 0; paste_index < paste_count; ++paste_index){ total_size += 1 + clipboard_index(app, 0, paste_index, 0, 0); @@ -279,7 +282,7 @@ multi_paste_range(Application_Links *app, View_Summary *view, Range range, i32 p } i32 pos = range.min; - buffer_replace_range(app, &buffer, range.min, range.max, str, total_size); + buffer_replace_range(app, buffer, range.min, range.max, make_string(str, total_size)); finish_range.min = pos; finish_range.max = pos + total_size; view_set_mark(app, view, seek_pos(finish_range.min)); @@ -343,8 +346,9 @@ multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 cli } if (in.abort){ - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + buffer_replace_range(app, buffer, range.min, range.max, make_lit_string("")); } } @@ -383,22 +387,22 @@ CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){ CUSTOM_COMMAND_SIG(rename_parameter) CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.") { - u32 access = AccessOpen; - View_Summary view = get_active_view(app, access); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + View_Summary view = get_active_view(app, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Partition *part = &global_part; Temp_Memory temp = begin_temp_memory(part); Cpp_Get_Token_Result result; - if (buffer_get_token_index(app, &buffer, view.cursor.pos, &result)){ + if (buffer_get_token_index(app, buffer, view.cursor.pos, &result)){ if (!result.in_whitespace_after_token){ static const i32 stream_space_size = 512; Cpp_Token stream_space[stream_space_size]; Stream_Tokens_DEP stream = {}; - if (init_stream_tokens(&stream, app, &buffer, result.token_index, stream_space, stream_space_size)){ + if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, stream_space_size)){ i32 token_index = result.token_index; Cpp_Token token = stream.tokens[token_index]; @@ -410,7 +414,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in if (token.size < sizeof(old_lexeme_base)){ Cpp_Token original_token = token; old_lexeme.size = token.size; - buffer_read_range(app, &buffer, token.start, token.start+token.size, old_lexeme.str); + buffer_read_range(app, buffer, token.start, token.start+token.size, old_lexeme.str); i32 proc_body_found = 0; b32 still_looping = 0; @@ -476,9 +480,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in char other_lexeme_base[128]; String other_lexeme = make_fixed_width_string(other_lexeme_base); other_lexeme.size = old_lexeme.size; - buffer_read_range(app, &buffer, token_ptr->start, - token_ptr->start+token_ptr->size, - other_lexeme.str); + buffer_read_range(app, buffer, token_ptr->start, token_ptr->start+token_ptr->size, other_lexeme.str); if (match(old_lexeme, other_lexeme)){ Buffer_Edit edit; @@ -520,8 +522,7 @@ CUSTOM_DOC("If the cursor is found to be on the name of a function parameter in doublebreak2:; if (closed_correctly){ - buffer_batch_edit(app, &buffer, replace_string.str, replace_string.size, - edits, edit_count, BatchEdit_Normal); + buffer_batch_edit(app, buffer, replace_string.str, replace_string.size, edits, edit_count, BatchEdit_Normal); } } } @@ -541,26 +542,25 @@ enum{ static void write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enum_Values_Mode mode){ - u32 access = AccessOpen; - View_Summary view = get_active_view(app, access); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, access); + View_Summary view = get_active_view(app, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Partition *part = &global_part; Temp_Memory temp = begin_temp_memory(part); Cpp_Get_Token_Result result; - if (buffer_get_token_index(app, &buffer, view.cursor.pos, &result)){ + if (buffer_get_token_index(app, buffer, view.cursor.pos, &result)){ if (!result.in_whitespace_after_token){ Cpp_Token stream_space[32]; Stream_Tokens_DEP stream = {}; - if (init_stream_tokens(&stream, app, &buffer, result.token_index, stream_space, 32)){ + if (init_stream_tokens(&stream, app, buffer, result.token_index, stream_space, 32)){ i32 token_index = result.token_index; Cpp_Token token = stream.tokens[token_index]; if (token.type == CPP_TOKEN_BRACE_OPEN){ - ++token_index; i32 seeker_index = token_index; @@ -684,8 +684,7 @@ write_explicit_enum_values_parameters(Application_Links *app, Write_Explicit_Enu finished:; if (closed_correctly){ - buffer_batch_edit(app, &buffer, string_base, string.size, - edits, edit_count, BatchEdit_Normal); + buffer_batch_edit(app, buffer, string_base, string.size, edits, edit_count, BatchEdit_Normal); } } } @@ -766,9 +765,8 @@ replace_all_occurrences_parameters(Application_Links *app, Heap *heap, Partition current_buffer_id = target->buffer_id; current_offset = 0; } - Buffer_Summary buffer = get_buffer(app, target->buffer_id, AccessOpen); i32 pos = target->start_pos + current_offset; - buffer_replace_range(app, &buffer, pos, pos + target_string.size, new_string.str, new_string.size); + buffer_replace_range(app, target->buffer_id, pos, pos + target_string.size, new_string); current_offset += shift_per_replacement; } diff --git a/4coder_font_helper.cpp b/4coder_font_helper.cpp index 105cc1e4..8f28bdc5 100644 --- a/4coder_font_helper.cpp +++ b/4coder_font_helper.cpp @@ -5,8 +5,9 @@ // TOP static Face_Description -get_buffer_face_description(Application_Links *app, Buffer_Summary *buffer){ - Face_ID current_id = get_face_id(app, buffer); +get_buffer_face_description(Application_Links *app, Buffer_ID buffer){ + Face_ID current_id = 0; + get_face_id(app, buffer, ¤t_id); Face_Description description = {}; if (current_id != 0){ description = get_face_description(app, current_id); @@ -114,8 +115,9 @@ change_global_face_by_description(Application_Links *app, Face_Description descr } static void -set_buffer_face_by_name(Application_Links *app, Buffer_Summary *buffer, char *name, i32 len){ - Face_ID current_id = get_face_id(app, buffer); +set_buffer_face_by_name(Application_Links *app, Buffer_ID buffer, char *name, i32 len){ + Face_ID current_id = 0; + get_face_id(app, buffer, ¤t_id); if (current_id != 0){ Face_Description description = get_face_description(app, current_id); Face_ID new_id = get_face_id_by_name(app, name, len, &description); diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index 7b9590ad..732a3725 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -42,7 +42,7 @@ struct Application_Links; #define BUFFER_SEND_END_SIGNAL_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id) #define CREATE_BUFFER_SIG(n) b32 n(Application_Links *app, String file_name, Buffer_Create_Flag flags, Buffer_ID *new_buffer_id_out) #define BUFFER_SAVE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, String file_name, u32 flags) -#define BUFFER_KILL_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result) +#define BUFFER_KILL_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result_out) #define BUFFER_REOPEN_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags, Buffer_Reopen_Result *result_out) #define BUFFER_GET_FILE_ATTRIBUTES_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out) #define GET_VIEW_NEXT_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out) @@ -142,7 +142,7 @@ struct Application_Links; #define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, i32 count) #define GET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, i32 count) #define FINALIZE_COLOR_SIG(n) argb_color n(Application_Links *app, int_color color) -#define GET_HOT_DIRECTORY_SIG(n) i32 n(Application_Links *app, String *out, i32 *required_size_out) +#define GET_HOT_DIRECTORY_SIG(n) b32 n(Application_Links *app, String *out, i32 *required_size_out) #define SET_HOT_DIRECTORY_SIG(n) b32 n(Application_Links *app, String string) #define GET_FILE_LIST_SIG(n) b32 n(Application_Links *app, String directory, File_List *list_out) #define FREE_FILE_LIST_SIG(n) void n(Application_Links *app, File_List list) @@ -965,7 +965,7 @@ static b32 buffer_get_token_index(Application_Links *app, Buffer_ID buffer_id, i static b32 buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_send_end_signal(app, buffer_id));} static b32 create_buffer(Application_Links *app, String file_name, Buffer_Create_Flag flags, Buffer_ID *new_buffer_id_out){return(app->create_buffer(app, file_name, flags, new_buffer_id_out));} static b32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String file_name, u32 flags){return(app->buffer_save(app, buffer_id, file_name, flags));} -static b32 buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result){return(app->buffer_kill(app, buffer_id, flags, result));} +static b32 buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result_out){return(app->buffer_kill(app, buffer_id, flags, result_out));} static b32 buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags, Buffer_Reopen_Result *result_out){return(app->buffer_reopen(app, buffer_id, flags, result_out));} static b32 buffer_get_file_attributes(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out){return(app->buffer_get_file_attributes(app, buffer_id, attributes_out));} static b32 get_view_next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_next(app, view_id, access, view_id_out));} @@ -1065,7 +1065,7 @@ static Available_Font get_available_font(Application_Links *app, i32 index){retu static void set_theme_colors(Application_Links *app, Theme_Color *colors, i32 count){(app->set_theme_colors(app, colors, count));} static void get_theme_colors(Application_Links *app, Theme_Color *colors, i32 count){(app->get_theme_colors(app, colors, count));} static argb_color finalize_color(Application_Links *app, int_color color){return(app->finalize_color(app, color));} -static i32 get_hot_directory(Application_Links *app, String *out, i32 *required_size_out){return(app->get_hot_directory(app, out, required_size_out));} +static b32 get_hot_directory(Application_Links *app, String *out, i32 *required_size_out){return(app->get_hot_directory(app, out, required_size_out));} static b32 set_hot_directory(Application_Links *app, String string){return(app->set_hot_directory(app, string));} static b32 get_file_list(Application_Links *app, String directory, File_List *list_out){return(app->get_file_list(app, directory, list_out));} static void free_file_list(Application_Links *app, File_List list){(app->free_file_list(app, list));} @@ -1148,7 +1148,7 @@ static b32 buffer_get_token_index(Application_Links *app, Buffer_ID buffer_id, i static b32 buffer_send_end_signal(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_send_end_signal_(app, buffer_id));} static b32 create_buffer(Application_Links *app, String file_name, Buffer_Create_Flag flags, Buffer_ID *new_buffer_id_out){return(app->create_buffer_(app, file_name, flags, new_buffer_id_out));} static b32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String file_name, u32 flags){return(app->buffer_save_(app, buffer_id, file_name, flags));} -static b32 buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result){return(app->buffer_kill_(app, buffer_id, flags, result));} +static b32 buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result_out){return(app->buffer_kill_(app, buffer_id, flags, result_out));} static b32 buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags, Buffer_Reopen_Result *result_out){return(app->buffer_reopen_(app, buffer_id, flags, result_out));} static b32 buffer_get_file_attributes(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out){return(app->buffer_get_file_attributes_(app, buffer_id, attributes_out));} static b32 get_view_next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_next_(app, view_id, access, view_id_out));} @@ -1248,7 +1248,7 @@ static Available_Font get_available_font(Application_Links *app, i32 index){retu static void set_theme_colors(Application_Links *app, Theme_Color *colors, i32 count){(app->set_theme_colors_(app, colors, count));} static void get_theme_colors(Application_Links *app, Theme_Color *colors, i32 count){(app->get_theme_colors_(app, colors, count));} static argb_color finalize_color(Application_Links *app, int_color color){return(app->finalize_color_(app, color));} -static i32 get_hot_directory(Application_Links *app, String *out, i32 *required_size_out){return(app->get_hot_directory_(app, out, required_size_out));} +static b32 get_hot_directory(Application_Links *app, String *out, i32 *required_size_out){return(app->get_hot_directory_(app, out, required_size_out));} static b32 set_hot_directory(Application_Links *app, String string){return(app->set_hot_directory_(app, string));} static b32 get_file_list(Application_Links *app, String directory, File_List *list_out){return(app->get_file_list_(app, directory, list_out));} static void free_file_list(Application_Links *app, File_List list){(app->free_file_list_(app, list));} diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index b9c50ee4..2dcb4dbf 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -255,92 +255,92 @@ int32_t source_name_len; int32_t line_number; }; static Command_Metadata fcoder_metacmd_table[234] = { -{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 331 }, +{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 336 }, { PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 623 }, { PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 633 }, { PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 612 }, -{ PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 101 }, +{ PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 104 }, { PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1215 }, -{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 510 }, -{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 187 }, -{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 155 }, -{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 151 }, -{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 234 }, -{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 244 }, -{ PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 209 }, -{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 441 }, -{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 210 }, -{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 196 }, -{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 224 }, -{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 240 }, -{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 }, -{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 }, -{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 518 }, -{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 1000 }, +{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 516 }, +{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 180 }, +{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 146 }, +{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 156 }, +{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 236 }, +{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 246 }, +{ PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 202 }, +{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 447 }, +{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 215 }, +{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 201 }, +{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 229 }, +{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 245 }, +{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1062 }, +{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 196 }, +{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 524 }, +{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 1021 }, { PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 135 }, { PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 161 }, { PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 }, -{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 129 }, -{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 35 }, -{ 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, 613 }, -{ 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, 590 }, -{ 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, 83 }, +{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 134 }, +{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 36 }, +{ 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, 621 }, +{ 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, 597 }, +{ 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, 84 }, { 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, 481 }, -{ 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, 1191 }, -{ 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, 1444 }, -{ 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, 139 }, +{ 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, 1197 }, +{ 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, 1451 }, +{ 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, 144 }, { PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1221 }, -{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1421 }, -{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 666 }, -{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 674 }, +{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1428 }, +{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 675 }, +{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 684 }, { PROC_LINKS(execute_any_cli, 0), "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 23 }, { PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 7 }, -{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 682 }, +{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 693 }, { PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1131 }, { PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1139 }, { PROC_LINKS(goto_first_jump_direct, 0), "goto_first_jump_direct", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 82 }, -{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 545 }, -{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 527 }, +{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 548 }, +{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 530 }, { PROC_LINKS(goto_jump_at_cursor_direct, 0), "goto_jump_at_cursor_direct", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 8 }, { PROC_LINKS(goto_jump_at_cursor_same_panel_direct, 0), "goto_jump_at_cursor_same_panel_direct", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list..", 168, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 28 }, -{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 371 }, -{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 343 }, -{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 690 }, +{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 374 }, +{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 346 }, +{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 701 }, { PROC_LINKS(goto_next_jump_direct, 0), "goto_next_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 46 }, { PROC_LINKS(goto_next_jump_no_skips_direct, 0), "goto_next_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 64 }, -{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 496 }, -{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 466 }, +{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 499 }, +{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 469 }, { PROC_LINKS(goto_prev_jump_direct, 0), "goto_prev_jump_direct", 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_direct.cpp", 34, 55 }, { PROC_LINKS(goto_prev_jump_no_skips_direct, 0), "goto_prev_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 73 }, -{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 512 }, -{ 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, 482 }, -{ 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, 548 }, -{ 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, 534 }, +{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 515 }, +{ 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, 485 }, +{ 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, 554 }, +{ 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, 540 }, { 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, 79 }, -{ 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, 601 }, -{ 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, 579 }, -{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 774 }, -{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 886 }, -{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 918 }, -{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 848 }, -{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 755 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1628 }, +{ 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, 608 }, +{ 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, 586 }, +{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 796 }, +{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 907 }, +{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 939 }, +{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 869 }, +{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 777 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1635 }, { PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 }, -{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 167 }, +{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 172 }, { PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 344 }, { PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 350 }, { PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 320 }, { PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 331 }, -{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 812 }, -{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 826 }, -{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 840 }, -{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 847 }, -{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 854 }, -{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 861 }, -{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 868 }, -{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 879 }, -{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 819 }, -{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\4coder_search.cpp", 29, 833 }, +{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 29, 801 }, +{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\4coder_search.cpp", 29, 815 }, +{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 829 }, +{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 836 }, +{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "w:\\4ed\\code\\4coder_search.cpp", 29, 843 }, +{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "w:\\4ed\\code\\4coder_search.cpp", 29, 850 }, +{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\4coder_search.cpp", 29, 857 }, +{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 29, 868 }, +{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 29, 808 }, +{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\4coder_search.cpp", 29, 822 }, { PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 }, { PROC_LINKS(lister__backspace_text_field, 0), "lister__backspace_text_field", 28, "A lister mode command that dispatches to the lister's backspace text field handler.", 83, "w:\\4ed\\code\\4coder_lists.cpp", 28, 41 }, { PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 145 }, @@ -358,69 +358,69 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\4coder_lists.cpp", 28, 125 }, { PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\4coder_lists.cpp", 28, 192 }, { PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 256 }, -{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1083 }, -{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1301 }, -{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 110 }, +{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1085 }, +{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1319 }, +{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 109 }, { PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 383 }, { PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 395 }, -{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 94 }, +{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 93 }, { PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 377 }, { PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 389 }, -{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 625 }, -{ PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 254 }, -{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 320 }, -{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 332 }, -{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 338 }, -{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 369 }, -{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1398 }, -{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1334 }, -{ PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 379 }, -{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 314 }, -{ PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 326 }, -{ PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 117 }, +{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 634 }, +{ PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 259 }, +{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 325 }, +{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 337 }, +{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 343 }, +{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 374 }, +{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1411 }, +{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1352 }, +{ PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 384 }, +{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 319 }, +{ PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 331 }, +{ PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 118 }, { PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 99 }, -{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 114 }, -{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 582 }, -{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 568 }, -{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 }, -{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 }, -{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1528 }, -{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1918 }, +{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 113 }, +{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 585 }, +{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 571 }, +{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1069 }, +{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1076 }, +{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1535 }, +{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1935 }, { PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 55 }, { PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 71 }, { PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 63 }, -{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1571 }, -{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 263 }, -{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 254 }, -{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 358 }, -{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 349 }, -{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 46 }, -{ 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(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1578 }, +{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 265 }, +{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 256 }, +{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 363 }, +{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 354 }, +{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 48 }, +{ 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, 138 }, +{ 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, 88 }, +{ 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, 145 }, { 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, 475 }, -{ 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, 1527 }, -{ 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, 1113 }, -{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1074 }, -{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1098 }, -{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1117 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1811 }, -{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1719 }, -{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 381 }, -{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1257 }, -{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 383 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1643 }, -{ PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 780 }, -{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 948 }, -{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 919 }, -{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 937 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1635 }, -{ 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, 1161 }, -{ 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, 1217 }, +{ 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, 1092 }, +{ 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 }, +{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1085 }, +{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1104 }, +{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1121 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1827 }, +{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1734 }, +{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 386 }, +{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1269 }, +{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 387 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1655 }, +{ PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 778 }, +{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 959 }, +{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 930 }, +{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 948 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1642 }, +{ 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, 1171 }, +{ 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, 1224 }, { 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, 716 }, -{ 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, 912 }, -{ 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, 926 }, +{ 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, 923 }, +{ 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, 937 }, { 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, 1195 }, { PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1207 }, { PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1201 }, @@ -439,55 +439,55 @@ static Command_Metadata fcoder_metacmd_table[234] = { { PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1153 }, { 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, 1039 }, { 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, 1107 }, -{ 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, 389 }, +{ 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, 394 }, { 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, 357 }, { 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, 376 }, { 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, 342 }, { 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 }, -{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 121 }, -{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 349 }, -{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 343 }, -{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1498 }, -{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1510 }, -{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1504 }, -{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1491 }, -{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 541 }, -{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 527 }, +{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 126 }, +{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 354 }, +{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 348 }, +{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1500 }, +{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1512 }, +{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1506 }, +{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1493 }, +{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 547 }, +{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 533 }, { PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1227 }, { PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1233 }, { PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 251 }, -{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 325 }, -{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1595 }, -{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 421 }, -{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 401 }, -{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 555 }, -{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 573 }, -{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 373 }, -{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 361 }, -{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 355 }, -{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 660 }, -{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 564 }, -{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 337 }, -{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 367 }, -{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 653 }, -{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 642 }, +{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 330 }, +{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1602 }, +{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 428 }, +{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 409 }, +{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 561 }, +{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 580 }, +{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 378 }, +{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 366 }, +{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 360 }, +{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 669 }, +{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 570 }, +{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 342 }, +{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 372 }, +{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 662 }, +{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 651 }, { PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 148 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1735 }, -{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1705 }, -{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1585 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1750 }, +{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1719 }, +{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1592 }, { PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 106 }, -{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 900 }, +{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 889 }, { PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 644 }, { PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 103 }, -{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 67 }, -{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 705 }, -{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 699 }, +{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 68 }, +{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 704 }, +{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 698 }, { PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 91 }, { PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 97 }, { PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 85 }, -{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 76 }, +{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 77 }, { PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 109 }, }; static int32_t fcoder_metacmd_ID_allow_mouse = 0; diff --git a/4coder_helper.cpp b/4coder_helper.cpp index 105fc562..6084932a 100644 --- a/4coder_helper.cpp +++ b/4coder_helper.cpp @@ -640,21 +640,6 @@ buffer_identifier_to_id(Application_Links *app, Buffer_Identifier identifier){ return(id); } -static Buffer_Summary -buffer_identifier_to_buffer_summary(Application_Links *app, Buffer_Identifier identifier, Access_Flag access){ - Buffer_Summary buffer = {}; - if (identifier.id != 0){ - buffer = get_buffer(app, identifier.id, access); - } - else{ - buffer = get_buffer_by_name(app, identifier.name, identifier.name_len, access); - if (!buffer.exists){ - buffer = get_buffer_by_file_name(app, identifier.name, identifier.name_len, access); - } - } - return(buffer); -} - static b32 view_open_file(Application_Links *app, View_Summary *view, char *filename, i32 filename_len, b32 never_new){ b32 result = false; @@ -733,18 +718,13 @@ static Buffer_Kill_Result kill_buffer(Application_Links *app, Buffer_Identifier identifier, View_ID gui_view_id, Buffer_Kill_Flag flags){ Buffer_Kill_Result result = kill_buffer(app, identifier, flags); if (result == BufferKillResult_Dirty){ - Buffer_Summary buffer = buffer_identifier_to_buffer_summary(app, identifier, AccessAll); + Buffer_ID buffer = buffer_identifier_to_id(app, identifier); View_Summary view = get_view(app, gui_view_id, AccessAll); - do_gui_sure_to_kill(app, buffer.buffer_id, &view); + do_gui_sure_to_kill(app, buffer, &view); } return(result); } -static void -refresh_buffer(Application_Links *app, Buffer_Summary *buffer){ - *buffer = get_buffer(app, buffer->buffer_id, AccessAll); -} - static void refresh_view(Application_Links *app, View_Summary *view){ *view = get_view(app, view->view_id, AccessAll); @@ -752,7 +732,7 @@ refresh_view(Application_Links *app, View_Summary *view){ // TODO(allen): Setup buffer seeking to do character_pos and get View_Summary out of this parameter list. static i32 -character_pos_to_pos(Application_Links *app, View_Summary *view, Buffer_Summary *buffer, i32 character_pos){ +character_pos_to_pos(Application_Links *app, View_Summary *view, i32 character_pos){ i32 result = 0; Full_Cursor cursor = {}; if (view_compute_cursor(app, view, seek_character_pos(character_pos), &cursor)){ @@ -873,6 +853,16 @@ scratch_read(Application_Links *app, Partition *scratch, Buffer_ID buffer, Cpp_T return(result); } +static b32 +token_match(Application_Links *app, Buffer_ID buffer, Cpp_Token token, String b){ + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + String a = scratch_read(app, scratch, buffer, make_range(token.start, token.start + token.size)); + b32 result = match(a, b); + end_temp_memory(temp); + return(result); +} + static String read_entire_buffer(Application_Links *app, Buffer_ID buffer_id, Arena *scratch){ i32 size = 0; @@ -880,6 +870,20 @@ read_entire_buffer(Application_Links *app, Buffer_ID buffer_id, Arena *scratch){ return(scratch_read(app, scratch, buffer_id, 0, size)); } +static i32 +buffer_get_line_number(Application_Links *app, Buffer_ID buffer, i32 pos){ + Partial_Cursor partial_cursor = {}; + buffer_compute_cursor(app, buffer, seek_pos(pos), &partial_cursor); + return(partial_cursor.line); +} + +static i32 +view_get_line_number(Application_Links *app, View_ID view, i32 pos){ + Full_Cursor cursor = {}; + view_compute_cursor(app, view, seek_pos(pos), &cursor); + return(cursor.line); +} + static i32 buffer_get_line_start(Application_Links *app, Buffer_ID buffer_id, i32 line){ i32 result = 0; @@ -908,13 +912,6 @@ buffer_get_line_end(Application_Links *app, Buffer_ID buffer_id, i32 line){ return(result); } -static i32 -buffer_get_line_number(Application_Links *app, Buffer_ID buffer, i32 pos){ - Partial_Cursor partial_cursor = {}; - buffer_compute_cursor(app, buffer, seek_pos(pos), &partial_cursor); - return(partial_cursor.line); -} - static Cpp_Token* get_first_token_at_line(Application_Links *app, Buffer_ID buffer_id, Cpp_Token_Array tokens, i32 line, i32 *line_start_out = 0){ i32 line_start = buffer_get_line_start(app, buffer_id, line); @@ -934,6 +931,15 @@ get_first_token_at_line(Application_Links *app, Buffer_ID buffer_id, Cpp_Token_A //////////////////////////////// +static void +clear_buffer(Application_Links *app, Buffer_ID buffer_id){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + buffer_replace_range(app, buffer_id, 0, buffer_size, make_lit_string("")); +} + +//////////////////////////////// + static b32 init_stream_chunk(Stream_Chunk *chunk, Application_Links *app, Buffer_ID buffer_id, i32 pos, char *data, u32 size){ @@ -1571,14 +1577,16 @@ view_has_highlighted_range(Application_Links *app, View_ID view_id){ static b32 if_view_has_highlighted_range_delete_range(Application_Links *app, View_ID view_id){ + b32 result = false; if (view_has_highlighted_range(app, view_id)){ View_Summary view = get_view(app, view_id, AccessAll); Range range = get_view_range(&view); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - buffer_replace_range(app, &buffer, range.min, range.max, 0, 0); - return(true); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); + buffer_replace_range(app, buffer, range.min, range.max, make_lit_string("")); + result = true; } - return(false); + return(result); } static void @@ -1652,6 +1660,40 @@ draw_margin(Application_Links *app, f32_Rect outer, f32_Rect inner, int_color co draw_rectangle(app, f32R(inner.x1, inner.y0, outer.x1, inner.y1), color); } +//////////////////////////////// + +static f32_Rect_Pair +split_rect(f32_Rect rect, View_Split_Kind kind, Coordinate coord, Side from_side, f32 t){ + f32_Rect_Pair result = {}; + if (kind == ViewSplitKind_FixedPixels){ + result.E[0] = rect; + result.E[1] = rect; + if (coord == Coordinate_X){ + result.E[0].x1 = (from_side == Side_Max) ? (rect.x1 - t) : (rect.x0 + t); + result.E[1].x0 = result.E[0].x1; + } + else{ + Assert(coord == Coordinate_Y); + result.E[0].y1 = (from_side == Side_Max) ? (rect.y1 - t) : (rect.y0 + t); + result.E[1].y0 = result.E[0].y1; + } + } + else{ + Assert(kind == ViewSplitKind_Ratio); + f32 pixel_count; + if (coord == Coordinate_X){ + pixel_count = t*(rect.x1 - rect.x0); + } + else{ + Assert(coord == Coordinate_Y); + pixel_count = t*(rect.y1 - rect.y0); + } + result = split_rect(rect, ViewSplitKind_FixedPixels, coord, from_side, pixel_count); + } + return(result); +} + + //////////////////////////////// static String @@ -1681,5 +1723,52 @@ buffer_push_file_name(Application_Links *app, Buffer_ID buffer, Arena *arena){ return(result); } +static String +buffer_limited_base_buffer_name(Application_Links *app, Buffer_ID buffer, char *memory, i32 max){ + String result = {}; + result.str = memory; + result.memory_size = max; + buffer_get_base_buffer_name(app, buffer, &result, 0); + return(result); +} + +static String +buffer_limited_unique_buffer_name(Application_Links *app, Buffer_ID buffer, char *memory, i32 max){ + String result = {}; + result.str = memory; + result.memory_size = max; + buffer_get_unique_buffer_name(app, buffer, &result, 0); + return(result); +} + +static String +buffer_limited_file_name(Application_Links *app, Buffer_ID buffer, char *memory, i32 max){ + String result = {}; + result.str = memory; + result.memory_size = max; + buffer_get_file_name(app, buffer, &result, 0); + return(result); +} + +//////////////////////////////// + +static b32 +buffer_has_name_with_star(Application_Links *app, Buffer_ID buffer){ + char first = 0; + String str = buffer_limited_unique_buffer_name(app, buffer, &first, 1); + return(str.size == 0 || first == '*'); +} + +//////////////////////////////// + +static float +get_dpi_scaling_value(Application_Links *app) +{ + // TODO(casey): Allen, this should return the multiplier for the display relative to whatever 4coder + // gets tuned to. + float result = 2.0f; + return(result); +} + // BOTTOM diff --git a/4coder_insertion.cpp b/4coder_insertion.cpp index 15ca5263..925b676c 100644 --- a/4coder_insertion.cpp +++ b/4coder_insertion.cpp @@ -22,15 +22,6 @@ begin_buffer_insertion_at_buffered(Application_Links *app, Buffer_ID buffer_id, return(result); } -#if 0 -static Buffer_Summary -get_active_buffer(Application_Links *app, Access_Flag access){ - View_Summary view = get_active_view(app, access); - Buffer_Summary result = get_buffer(app, view.buffer_id, access); - return(result); -} -#endif - static Buffer_Insertion begin_buffer_insertion(Application_Links *app){ View_ID view = 0; @@ -110,13 +101,13 @@ insert_line_from_buffer(Buffer_Insertion *insertion, Buffer_ID buffer_id, i32 li Partial_Cursor begin = {}; Partial_Cursor end = {}; - Buffer_Summary buffer = get_buffer(insertion->app, buffer_id, AccessAll); - b32 success = false; - if (buffer_compute_cursor(insertion->app, &buffer, seek_line_char(line, 1), &begin)){ - if (buffer_compute_cursor(insertion->app, &buffer, seek_line_char(line, -1), &end)){ + if (buffer_compute_cursor(insertion->app, buffer_id, seek_line_char(line, 1), &begin)){ + if (buffer_compute_cursor(insertion->app, buffer_id, seek_line_char(line, -1), &end)){ if (begin.line == line){ - if (0 <= begin.pos && begin.pos <= end.pos && end.pos <= buffer.size){ + i32 buffer_size = 0; + buffer_get_size(insertion->app, buffer_id, &buffer_size); + if (0 <= begin.pos && begin.pos <= end.pos && end.pos <= buffer_size){ i32 size = (end.pos - begin.pos); if(truncate_at && (size > truncate_at)) { @@ -127,7 +118,7 @@ insert_line_from_buffer(Buffer_Insertion *insertion, Buffer_ID buffer_id, i32 li if (memory != 0){ String str = make_string(memory, 0, size); success = true; - buffer_read_range(insertion->app, &buffer, begin.pos, end.pos, str.str); + buffer_read_range(insertion->app, buffer_id, begin.pos, end.pos, str.str); str.size = size; insert_string(insertion, str); } diff --git a/4coder_jump_direct.cpp b/4coder_jump_direct.cpp index f0088ac3..8ab4327f 100644 --- a/4coder_jump_direct.cpp +++ b/4coder_jump_direct.cpp @@ -100,30 +100,28 @@ CUSTOM_COMMAND_SIG(newline_or_goto_position_direct) CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - - if (buffer.lock_flags & AccessProtected){ - goto_jump_at_cursor_direct(app); - lock_jump_buffer(buffer); - } - else{ + Buffer_ID buffer = 0; + if (view_get_buffer(app, view.view_id, AccessOpen, &buffer)){ write_character(app); } + else if (view_get_buffer(app, view.view_id, AccessProtected, &buffer)){ + goto_jump_at_cursor_direct(app); + lock_jump_buffer(app, buffer); + } } CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel_direct) CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - - if (buffer.lock_flags & AccessProtected){ - goto_jump_at_cursor_same_panel_direct(app); - lock_jump_buffer(buffer); - } - else{ + Buffer_ID buffer = 0; + if (view_get_buffer(app, view.view_id, AccessOpen, &buffer)){ write_character(app); } + else if (view_get_buffer(app, view.view_id, AccessProtected, &buffer)){ + goto_jump_at_cursor_same_panel_direct(app); + lock_jump_buffer(app, buffer); + } } // BOTTOM diff --git a/4coder_jump_sticky.cpp b/4coder_jump_sticky.cpp index 4bc55bba..e0a98473 100644 --- a/4coder_jump_sticky.cpp +++ b/4coder_jump_sticky.cpp @@ -39,7 +39,7 @@ binary_search(u32 *array, i32 stride, i32 count, u32 x){ } static Sticky_Jump_Array -parse_buffer_to_jump_array(Application_Links *app, Partition *arena, Buffer_Summary buffer){ +parse_buffer_to_jump_array(Application_Links *app, Partition *arena, Buffer_ID buffer){ Sticky_Jump_Array result = {}; result.jumps = push_array(arena, Sticky_Jump, 0); @@ -52,7 +52,7 @@ parse_buffer_to_jump_array(Application_Links *app, Partition *arena, Buffer_Summ Temp_Memory temp = begin_temp_memory(arena); String line_str = {}; - if (read_line(app, arena, buffer.buffer_id, line, &line_str)){ + if (read_line(app, arena, buffer, line, &line_str)){ Parsed_Jump parsed_jump = parse_jump_location(line_str); if (parsed_jump.success){ Buffer_ID jump_buffer = {}; @@ -92,16 +92,16 @@ static char sticky_jump_marker_handle_var[] = "DEFAULT.sticky_jump_marker_han static i32 sticky_jump_marker_handle_loc; static void -init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_ID buffer_id, - Marker_List *list){ - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); - b32 is_compilation_buffer = match(make_string(buffer.buffer_name, buffer.buffer_name_len), "*compilation*"); +init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_ID buffer, Marker_List *list){ + Arena *scratch_arena = context_get_arena(app); + Temp_Memory_Arena temp_arena = begin_temp_memory(scratch_arena); + + String buffer_name = buffer_push_base_buffer_name(app, buffer, scratch_arena); + b32 is_compilation_buffer = match(buffer_name, "*compilation*"); Temp_Memory temp = begin_temp_memory(scratch); Sticky_Jump_Array jumps = parse_buffer_to_jump_array(app, scratch, buffer); - Range_Array buffer_ranges = get_ranges_of_duplicate_keys(scratch, - &jumps.jumps->jump_buffer_id, sizeof(*jumps.jumps), - jumps.count); + Range_Array buffer_ranges = get_ranges_of_duplicate_keys(scratch, &jumps.jumps->jump_buffer_id, sizeof(*jumps.jumps), jumps.count); Sort_Pair_i32 *range_index_buffer_id_pairs = push_array(scratch, Sort_Pair_i32, buffer_ranges.count); for (i32 i = 0; i < buffer_ranges.count; i += 1){ range_index_buffer_id_pairs[i].index = i; @@ -116,7 +116,7 @@ init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_ Sticky_Jump_Stored *stored = push_array(scratch, Sticky_Jump_Stored, jumps.count); Managed_Scope scope_array[2] = {}; - scope_array[0] = buffer_get_managed_scope(app, buffer_id); + scope_array[0] = buffer_get_managed_scope(app, buffer); for (i32 i = 0; i < scoped_buffer_ranges.count; i += 1){ Range buffer_range_indices = scoped_buffer_ranges.ranges[i]; @@ -173,8 +173,10 @@ init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_ list->jump_array = stored_jump_array; list->jump_count = jumps.count; - list->previous_size = buffer.size; - list->buffer_id = buffer_id; + buffer_get_size(app, buffer, &list->previous_size); + list->buffer_id = buffer; + + end_temp_memory(temp_arena); } static void @@ -213,9 +215,10 @@ static Marker_List* get_or_make_list_for_buffer(Application_Links *app, Partition *scratch, Heap *heap, Buffer_ID buffer_id){ Marker_List *result = get_marker_list_for_buffer(buffer_id); if (result != 0){ - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); - // TODO(allen): When buffers get an "edit sequence number" use that instead. - if (result->previous_size != buffer.size){ + i32 buffer_size = 0; + buffer_get_size(app, buffer_id, &buffer_size); + // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): When buffers get an "edit sequence number" use that instead. + if (result->previous_size != buffer_size){ delete_marker_list(result); result = 0; } @@ -569,28 +572,28 @@ CUSTOM_COMMAND_SIG(newline_or_goto_position_sticky) CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - if (buffer.lock_flags & AccessProtected){ - goto_jump_at_cursor_sticky(app); - lock_jump_buffer(buffer); - } - else{ + Buffer_ID buffer = 0; + if (view_get_buffer(app, view.view_id, AccessOpen, &buffer)){ write_character(app); } + else if (view_get_buffer(app, view.view_id, AccessProtected, &buffer)){ + goto_jump_at_cursor_sticky(app); + lock_jump_buffer(app, buffer); + } } CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel_sticky) CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.") { View_Summary view = get_active_view(app, AccessProtected); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); - if (buffer.lock_flags & AccessProtected){ - goto_jump_at_cursor_same_panel_sticky(app); - lock_jump_buffer(buffer); - } - else{ + Buffer_ID buffer = 0; + if (view_get_buffer(app, view.view_id, AccessOpen, &buffer)){ write_character(app); } + else if (view_get_buffer(app, view.view_id, AccessProtected, &buffer)){ + goto_jump_at_cursor_same_panel_sticky(app); + lock_jump_buffer(app, buffer); + } } // diff --git a/4coder_jumping.cpp b/4coder_jumping.cpp index f5ce76fa..975356ef 100644 --- a/4coder_jumping.cpp +++ b/4coder_jumping.cpp @@ -295,9 +295,10 @@ seek_next_jump_in_buffer(Application_Links *app, Partition *part, static ID_Line_Column_Jump_Location convert_name_based_to_id_based(Application_Links *app, Name_Line_Column_Location loc){ ID_Line_Column_Jump_Location result = {}; - Buffer_Summary buffer = get_buffer_by_name(app, loc.file.str, loc.file.size, AccessAll); - if (buffer.exists){ - result.buffer_id = buffer.buffer_id; + Buffer_ID buffer = 0; + get_buffer_by_name(app, loc.file, AccessAll, &buffer); + if (buffer != 0){ + result.buffer_id = buffer; result.line = loc.line; result.column = loc.column; } diff --git a/4coder_lists.cpp b/4coder_lists.cpp index d471456e..af31499c 100644 --- a/4coder_lists.cpp +++ b/4coder_lists.cpp @@ -458,15 +458,20 @@ begin_integrated_lister__theme_list(Application_Links *app, char *query_string, //////////////////////////////// static void -generate_all_buffers_list__output_buffer(Lister *lister, Buffer_Summary buffer){ +generate_all_buffers_list__output_buffer(Application_Links *app, Lister *lister, Buffer_ID buffer){ + Dirty_State dirty = 0; + buffer_get_dirty_state(app, buffer, &dirty); String status = {}; - switch (buffer.dirty){ + switch (dirty){ case DirtyState_UnsavedChanges: status = make_lit_string("*"); break; case DirtyState_UnloadedChanges: status = make_lit_string("!"); break; case DirtyState_UnsavedChangesAndUnloadedChanges: status = make_lit_string("*!"); break; } - String buffer_name = make_string(buffer.buffer_name, buffer.buffer_name_len); - lister_add_item(lister, buffer_name, status, IntAsPtr(buffer.buffer_id), 0); + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch); + String buffer_name = buffer_push_unique_buffer_name(app, buffer, scratch); + lister_add_item(lister, buffer_name, status, IntAsPtr(buffer), 0); + end_temp_memory(temp); } static void @@ -474,10 +479,15 @@ generate_all_buffers_list(Application_Links *app, Lister *lister){ i32 buffer_count = get_buffer_count(app); i32 memory_size = 0; memory_size += buffer_count*(sizeof(Lister_Node) + 3); - for (Buffer_Summary buffer = get_buffer_first(app, AccessAll); - buffer.exists; - get_buffer_next(app, &buffer, AccessAll)){ - memory_size += buffer.buffer_name_len; + { + Buffer_ID buffer = 0; + for (get_buffer_next(app, 0, AccessAll, &buffer); + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ + i32 name_length = 0; + buffer_get_unique_buffer_name(app, buffer, 0, &name_length); + memory_size += name_length; + } } lister_begin_new_item_set(app, lister, memory_size); @@ -500,37 +510,42 @@ generate_all_buffers_list(Application_Links *app, Lister *lister){ } // Regular Buffers - for (Buffer_Summary buffer = get_buffer_first(app, AccessAll); - buffer.exists; - get_buffer_next(app, &buffer, AccessAll)){ - for (i32 i = 0; i < currently_viewed_buffer_count; i += 1){ - if (buffer.buffer_id == buffers_currently_being_viewed[i]){ - goto skip1; + { + Buffer_ID buffer = 0; + for (get_buffer_next(app, 0, AccessAll, &buffer); + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ + for (i32 i = 0; i < currently_viewed_buffer_count; i += 1){ + if (buffer == buffers_currently_being_viewed[i]){ + goto skip1; + } } + if (!buffer_has_name_with_star(app, buffer)){ + generate_all_buffers_list__output_buffer(app, lister, buffer); + } + skip1:; } - if (buffer.buffer_name_len == 0 || buffer.buffer_name[0] != '*'){ - generate_all_buffers_list__output_buffer(lister, buffer); - } - skip1:; } // Buffers Starting with * - for (Buffer_Summary buffer = get_buffer_first(app, AccessAll); - buffer.exists; - get_buffer_next(app, &buffer, AccessAll)){ - for (i32 i = 0; i < currently_viewed_buffer_count; i += 1){ - if (buffer.buffer_id == buffers_currently_being_viewed[i]){ - goto skip2; + { + Buffer_ID buffer = 0; + for (get_buffer_next(app, 0, AccessAll, &buffer); + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ + for (i32 i = 0; i < currently_viewed_buffer_count; i += 1){ + if (buffer == buffers_currently_being_viewed[i]){ + goto skip2; + } } + if (!buffer_has_name_with_star(app, buffer)){ + generate_all_buffers_list__output_buffer(app, lister, buffer); + } + skip2:; } - if (buffer.buffer_name_len != 0 && buffer.buffer_name[0] == '*'){ - generate_all_buffers_list__output_buffer(lister, buffer); - } - skip2:; } // Buffers That Are Open in Views for (i32 i = 0; i < currently_viewed_buffer_count; i += 1){ - Buffer_Summary buffer = get_buffer(app, buffers_currently_being_viewed[i], AccessAll); - generate_all_buffers_list__output_buffer(lister, buffer); + generate_all_buffers_list__output_buffer(app, lister, buffers_currently_being_viewed[i]); } } @@ -586,7 +601,7 @@ generate_hot_directory_file_list(Application_Links *app, Lister *lister){ char *status_flag = ""; - Buffer_Summary buffer = {}; + Buffer_ID buffer = {}; { Temp_Memory_Arena path_temp = begin_temp_memory(&lister->arena); @@ -600,13 +615,15 @@ generate_hot_directory_file_list(Application_Links *app, Lister *lister){ append(&full_file_path, "/"); } append(&full_file_path, make_string(info->filename, info->filename_len)); - buffer = get_buffer_by_file_name(app, full_file_path.str, full_file_path.size, AccessAll); + get_buffer_by_file_name(app, full_file_path, AccessAll, &buffer); end_temp_memory(path_temp); } - if (buffer.exists){ + if (buffer != 0){ is_loaded = "LOADED"; - switch (buffer.dirty){ + Dirty_State dirty = 0; + buffer_get_dirty_state(app, buffer, &dirty); + switch (dirty){ case DirtyState_UnsavedChanges: status_flag = " *"; break; case DirtyState_UnloadedChanges: status_flag = " !"; break; case DirtyState_UnsavedChangesAndUnloadedChanges: status_flag = " *!"; break; @@ -665,18 +682,23 @@ activate_confirm_kill(Application_Links *app, Partition *scratch, Heap *heap, Vi case SureToKill_Save: { - Buffer_Summary buffer = get_buffer(app, buffer_id, AccessAll); - if (save_buffer(app, &buffer, buffer.file_name, buffer.file_name_len, BufferSave_IgnoreDirtyFlag)){ - kill_buffer(app, buffer_identifier(buffer_id), BufferKill_AlwaysKill); + Arena *scratch_arena = context_get_arena(app); + Temp_Memory_Arena temp = begin_temp_memory(scratch_arena); + String file_name = buffer_push_file_name(app, buffer_id, scratch_arena); + + if (buffer_save(app, buffer_id, file_name, BufferSave_IgnoreDirtyFlag)){ + buffer_kill(app, buffer_id, BufferKill_AlwaysKill, 0); } else{ char space[256]; String str = make_fixed_width_string(space); append(&str, "Did not close '"); - append(&str, make_string(buffer.file_name, buffer.file_name_len)); + append(&str, file_name); append(&str, "' because it did not successfully save.\n"); print_message(app, str.str, str.size); } + + end_temp_memory(temp); }break; } lister_default(app, scratch, heap, view, state, ListerActivation_Finished); @@ -794,21 +816,20 @@ activate_open_or_new__generic(Application_Links *app, Partition *scratch, View_S Temp_Memory temp = begin_temp_memory(scratch); String full_file_name = {}; if (path.size == 0 || !char_is_slash(path.str[path.size - 1])){ - full_file_name = string_push_f(scratch, "%.*s/%.*s", - path.size, path.str, file_name.size, file_name.str); + full_file_name = string_push_f(scratch, "%.*s/%.*s", path.size, path.str, file_name.size, file_name.str); } else{ - full_file_name = string_push_f(scratch, "%.*s%.*s", - path.size, path.str, file_name.size, file_name.str); + full_file_name = string_push_f(scratch, "%.*s%.*s", path.size, path.str, file_name.size, file_name.str); } if (is_folder){ directory_set_hot(app, full_file_name.str, full_file_name.size); result = ListerActivation_ContinueAndRefresh; } else{ - Buffer_Summary buffer = create_buffer(app, full_file_name.str, full_file_name.size, flags); - if (buffer.exists){ - view_set_buffer(app, view, buffer.buffer_id, SetBuffer_KeepOriginalGUI); + Buffer_ID buffer = 0; + create_buffer(app, full_file_name, flags, &buffer); + if (buffer != 0){ + view_set_buffer(app, view, buffer, SetBuffer_KeepOriginalGUI); } result = ListerActivation_Finished; } diff --git a/4coder_miblo_numbers.cpp b/4coder_miblo_numbers.cpp index 79fc7234..12444c67 100644 --- a/4coder_miblo_numbers.cpp +++ b/4coder_miblo_numbers.cpp @@ -6,7 +6,7 @@ and decrementing various forms of number as numerical objects despite being enco // TOP static i32 -get_numeric_string_at_cursor(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, i32 *numeric_start, i32 *numeric_end){ +get_numeric_string_at_cursor(Application_Links *app, Buffer_ID buffer, i32 start_pos, i32 *numeric_start, i32 *numeric_end){ i32 result = 0; char current = buffer_get_char(app, buffer, start_pos); @@ -23,8 +23,8 @@ get_numeric_string_at_cursor(Application_Links *app, Buffer_Summary *buffer, i32 if (init_stream_chunk(&stream, app, buffer, start_pos, chunk, chunk_size)){ - i32 still_looping = 1; - while (still_looping){ + b32 still_looping = true; + for (;still_looping;){ for (; pos >= stream.start; --pos){ char at_pos = stream.data[pos]; if (!char_is_numeric(at_pos)){ @@ -38,7 +38,6 @@ get_numeric_string_at_cursor(Application_Links *app, Buffer_Summary *buffer, i32 pos1 = pos; if (init_stream_chunk(&stream, app, buffer, start_pos, chunk, chunk_size)){ - still_looping = 1; while (still_looping){ for (; pos < stream.end; ++pos){ @@ -68,7 +67,7 @@ struct Miblo_Number_Info{ }; static i32 -get_numeric_at_cursor(Application_Links *app, Buffer_Summary *buffer, i32 pos, Miblo_Number_Info *info){ +get_numeric_at_cursor(Application_Links *app, Buffer_ID buffer, i32 pos, Miblo_Number_Info *info){ i32 result = 0; i32 numeric_start = 0, numeric_end = 0; @@ -95,14 +94,14 @@ CUSTOM_COMMAND_SIG(miblo_increment_basic) CUSTOM_DOC("Increment an integer under the cursor by one.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Miblo_Number_Info number = {}; - if (get_numeric_at_cursor(app, &buffer, view.cursor.pos, &number)){ + if (get_numeric_at_cursor(app, buffer, view.cursor.pos, &number)){ char str_space[1024]; String str = make_fixed_width_string(str_space); int_to_str(&str, number.x + 1); - buffer_replace_range(app, &buffer, number.start, number.end, str.str, str.size); + buffer_replace_range(app, buffer, number.start, number.end, str); view_set_cursor(app, &view, seek_pos(number.start + str.size - 1), 1); } } @@ -111,14 +110,14 @@ CUSTOM_COMMAND_SIG(miblo_decrement_basic) CUSTOM_DOC("Decrement an integer under the cursor by one.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Miblo_Number_Info number = {}; - if (get_numeric_at_cursor(app, &buffer, view.cursor.pos, &number)){ + if (get_numeric_at_cursor(app, buffer, view.cursor.pos, &number)){ char str_space[1024]; String str = make_fixed_width_string(str_space); int_to_str(&str, number.x - 1); - buffer_replace_range(app, &buffer, number.start, number.end, str.str, str.size); + buffer_replace_range(app, buffer, number.start, number.end, str); view_set_cursor(app, &view, seek_pos(number.start + str.size - 1), 1); } } @@ -127,7 +126,7 @@ CUSTOM_DOC("Decrement an integer under the cursor by one.") // (h+:)?m?m:ss static i32 -get_timestamp_string_at_cursor(Application_Links *app, Buffer_Summary *buffer, i32 start_pos, i32 *timestamp_start, i32 *timestamp_end){ +get_timestamp_string_at_cursor(Application_Links *app, Buffer_ID buffer, i32 start_pos, i32 *timestamp_start, i32 *timestamp_end){ i32 result = 0; char current = buffer_get_char(app, buffer, start_pos); @@ -280,7 +279,7 @@ struct Miblo_Timestamp_Info{ }; static i32 -get_timestamp_at_cursor(Application_Links *app, Buffer_Summary *buffer, i32 pos, Miblo_Timestamp_Info *info){ +get_timestamp_at_cursor(Application_Links *app, Buffer_ID buffer, i32 pos, Miblo_Timestamp_Info *info){ i32 result = 0; i32 timestamp_start = 0, timestamp_end = 0; @@ -360,16 +359,17 @@ get_timestamp_at_cursor(Application_Links *app, Buffer_Summary *buffer, i32 pos, static void miblo_time_stamp_alter(Application_Links *app, i32 unit_type, i32 amt){ View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); + Buffer_ID buffer = 0; + view_get_buffer(app, view.view_id, AccessOpen, &buffer); Miblo_Timestamp_Info timestamp = {}; - if (get_timestamp_at_cursor(app, &buffer, view.cursor.pos, ×tamp)){ + if (get_timestamp_at_cursor(app, buffer, view.cursor.pos, ×tamp)){ char str_space[1024]; String str = make_fixed_width_string(str_space); Miblo_Timestamp inc_timestamp = increment_timestamp(timestamp.time, unit_type, amt); timestamp_to_str(&str, inc_timestamp); - buffer_replace_range(app, &buffer, timestamp.start, timestamp.end, str.str, str.size); + buffer_replace_range(app, buffer, timestamp.start, timestamp.end, str); view_set_cursor(app, &view, seek_pos(timestamp.start + str.size - 1), 1); } } diff --git a/4coder_project_commands.cpp b/4coder_project_commands.cpp index 41bafb01..4ae7d390 100644 --- a/4coder_project_commands.cpp +++ b/4coder_project_commands.cpp @@ -37,45 +37,47 @@ get_pattern_array_from_extension_list(Partition *arena, Extension_List extension /////////////////////////////// static void -close_all_files_with_extension(Application_Links *app, Partition *scratch_part, - CString_Array extension_array){ +close_all_files_with_extension(Application_Links *app, Partition *scratch_part, CString_Array extension_array){ Temp_Memory temp = begin_temp_memory(scratch_part); i32 buffers_to_close_max = part_remaining(scratch_part)/sizeof(i32); i32 *buffers_to_close = push_array(scratch_part, i32, buffers_to_close_max); i32 buffers_to_close_count = 0; - b32 do_repeat = 0; + b32 do_repeat = false; do{ buffers_to_close_count = 0; - do_repeat = 0; + do_repeat = false; - u32 access = AccessAll; - Buffer_Summary buffer = {}; - for (buffer = get_buffer_first(app, access); - buffer.exists; - get_buffer_next(app, &buffer, access)){ + Buffer_ID buffer = 0; + for (buffer = get_buffer_next(app, 0, AccessAll, &buffer); + buffer != 0; + get_buffer_next(app, buffer, AccessAll, &buffer)){ + b32 is_match = true; - b32 is_match = 1; if (extension_array.count > 0){ - is_match = 0; - if (buffer.file_name != 0){ - String extension = file_extension(make_string(buffer.file_name, buffer.file_name_len)); + Arena *scratch = context_get_arena(app); + Temp_Memory_Arena name_temp = begin_temp_memory(scratch); + String file_name = buffer_push_file_name(app, buffer, scratch); + is_match = false; + if (file_name.size > 0){ + String extension = file_extension(file_name); for (i32 i = 0; i < extension_array.count; ++i){ if (match(extension, extension_array.strings[i])){ - is_match = 1; + is_match = true; break; } } } + end_temp_memory(name_temp); } if (is_match){ if (buffers_to_close_count >= buffers_to_close_max){ - do_repeat = 1; + do_repeat = true; break; } - buffers_to_close[buffers_to_close_count++] = buffer.buffer_id; + buffers_to_close[buffers_to_close_count++] = buffer; } } diff --git a/4coder_search.cpp b/4coder_search.cpp index 3270ad4d..54cc9b36 100644 --- a/4coder_search.cpp +++ b/4coder_search.cpp @@ -552,10 +552,7 @@ initialize_generic_search_all_buffers(Application_Links *app, Heap *heap, String } if (!skip){ - char first_char = 0; - String str = make_string_cap(&first_char, 0, 1); - buffer_get_unique_buffer_name(app, buffer_it, &str, 0); - if (first_char != '*'){ + if (!buffer_has_name_with_star(app, buffer_it)){ ranges[j].type = SearchRange_FrontToBack; ranges[j].flags = match_flags; ranges[j].buffer = buffer_it; @@ -564,7 +561,6 @@ initialize_generic_search_all_buffers(Application_Links *app, Heap *heap, String ++j; } } - } set->count = j; @@ -798,13 +794,6 @@ list_type_definition__parameters(Application_Links *app, Heap *heap, Partition * default_target_view); end_temp_memory(temp); - -#if 0 - Buffer_Summary buffer = get_buffer_by_name(app, literal("*search*"), AccessAll); - if (buffer.line_count == 2){ - goto_first_jump_same_panel_sticky(app); - } -#endif } //////////////////////////////// @@ -901,11 +890,8 @@ CUSTOM_COMMAND_SIG(word_complete) CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.") { View_Summary view = get_active_view(app, AccessOpen); - Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen); - - // NOTE(allen): I just do this because this command is a lot of work - // and there is no point in doing any of it if nothing will happen anyway. - if (buffer.exists){ + Buffer_ID buffer = 0; + if (view_get_buffer(app, view.view_id, AccessOpen, &buffer)){ i32 do_init = false; Managed_Scope scope = view_get_managed_scope(app, view.view_id); @@ -934,7 +920,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with char space[1024]; Stream_Chunk chunk = {}; - if (init_stream_chunk(&chunk, app, buffer.buffer_id, cursor_pos, space, sizeof(space))){ + if (init_stream_chunk(&chunk, app, buffer, cursor_pos, space, sizeof(space))){ i32 still_looping = true; do{ for (; cursor_pos >= chunk.start; --cursor_pos){ @@ -962,7 +948,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with complete_state.initialized = true; Search_Key key = {}; search_key_alloc(&global_heap, &key, &size, 1); - buffer_read_range(app, &buffer, word_start, word_end, key.words[0].str); + buffer_read_range(app, buffer, word_start, word_end, key.words[0].str); key.words[0].size = size; search_iter_init(&complete_state.iter, key); @@ -974,22 +960,24 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with Search_Range *ranges = complete_state.set.ranges; ranges[0].type = SearchRange_Wave; ranges[0].flags = SearchFlag_MatchWordPrefix; - ranges[0].buffer = buffer.buffer_id; + ranges[0].buffer = buffer; ranges[0].start = 0; - ranges[0].size = buffer.size; + buffer_get_size(app, buffer, &ranges[0].size); ranges[0].mid_start = word_start; ranges[0].mid_size = size; + Buffer_ID buffer_it = 0; + i32 j = 1; - for (Buffer_Summary buffer_it = get_buffer_first(app, AccessAll); - buffer_it.exists; - get_buffer_next(app, &buffer_it, AccessAll)){ - if (buffer.buffer_id != buffer_it.buffer_id){ + for (get_buffer_next(app, 0, AccessAll, &buffer_it); + buffer_it != 0; + get_buffer_next(app, buffer_it, AccessAll, &buffer_it)){ + if (buffer != buffer_it){ ranges[j].type = SearchRange_FrontToBack; ranges[j].flags = SearchFlag_MatchWordPrefix; - ranges[j].buffer = buffer_it.buffer_id; + ranges[j].buffer = buffer_it; ranges[j].start = 0; - ranges[j].size = buffer_it.size; + buffer_get_size(app, buffer_it, &ranges[j].size); ++j; } } @@ -1023,7 +1011,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with buffer_read_range(app, match.buffer, match.start, match.end, spare); if (search_hit_add(&global_heap, &complete_state.hits, &complete_state.str, spare, match_size)){ - buffer_replace_range(app, &buffer, word_start, word_end, spare, match_size); + buffer_replace_range(app, buffer, word_start, word_end, make_string(spare, match_size)); view_set_cursor(app, &view, seek_pos(word_start + match_size), true); complete_state.word_end = word_start + match_size; @@ -1043,7 +1031,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with match_size = word.size; char *str = word.str; - buffer_replace_range(app, &buffer, word_start, word_end, str, match_size); + buffer_replace_range(app, buffer, word_start, word_end, make_string(str, match_size)); view_set_cursor(app, &view, seek_pos(word_start + match_size), true); complete_state.word_end = word_start + match_size; diff --git a/4coder_ui_helper.cpp b/4coder_ui_helper.cpp index dfa0046d..4598b058 100644 --- a/4coder_ui_helper.cpp +++ b/4coder_ui_helper.cpp @@ -140,20 +140,18 @@ ui_control_set_bottom(UI_Data *data, i32 bottom_y){ static UI_Item* ui_control_get_mouse_hit(UI_Data *data, Vec2_i32 view_p, Vec2_i32 panel_p){ UI_Item *result = 0; - for (UI_Item *item = data->list.first; - item != 0 && result == 0; - item = item->next){ + for (UI_Item *item = data->list.first; item != 0 && result == 0; item = item->next){ i32_Rect r = item->rect_outer; switch (item->coordinates){ case UICoordinates_ViewSpace: { - if (hit_check(r, view_p)){ + if (rect_contains_point(r, view_p)){ result = item; } }break; case UICoordinates_PanelSpace: { - if (hit_check(r, panel_p)){ + if (rect_contains_point(r, panel_p)){ result = item; } }break; @@ -463,7 +461,7 @@ lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view, UI_Item *item_ptr = ui_list_add_item(ui_arena, &ui_data->list, item); - if (hit_check(item_rect, view_m)){ + if (rect_contains_point(item_rect, view_m)){ hovered_item = item_ptr; } if (state->item_index == item_index_counter){ diff --git a/4ed.cpp b/4ed.cpp index d4febcbb..8b399323 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -1107,8 +1107,8 @@ App_Step_Sig(app_step){ } if (input->mouse.p != models->prev_p){ - b32 was_in_window = hit_check(i32R(0, 0, prev_dim.x, prev_dim.y), models->prev_p); - b32 is_in_window = hit_check(i32R(0, 0, current_dim.x, current_dim.y), input->mouse.p); + b32 was_in_window = rect_contains_point(i32R(0, 0, prev_dim.x, prev_dim.y), models->prev_p); + b32 is_in_window = rect_contains_point(i32R(0, 0, current_dim.x, current_dim.y), input->mouse.p); if (is_in_window || was_in_window){ mouse_event.keycode = key_mouse_move; input->keys.keys[input->keys.count++] = mouse_event; @@ -1132,14 +1132,14 @@ App_Step_Sig(app_step){ for (Panel *panel = layout_get_first_open_panel(layout); panel != 0; panel = layout_get_next_open_panel(layout, panel)){ - if (hit_check(mouse.x, mouse.y, panel->rect_full)){ + if (rect_contains_point(panel->rect_full, mouse)){ mouse_panel = panel; - if (!hit_check(mouse.x, mouse.y, panel->rect_inner)){ + if (!rect_contains_point(panel->rect_inner, mouse)){ mouse_in_margin = true; for (divider_panel = mouse_panel->parent; divider_panel != 0; divider_panel = divider_panel->parent){ - if (hit_check(mouse.x, mouse.y, divider_panel->rect_inner)){ + if (rect_contains_point(divider_panel->rect_inner, mouse)){ break; } } diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index a5dcbbd1..f89ce66f 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -1602,7 +1602,7 @@ DOC_SEE(Buffer_Save_Flag) // TODO(allen): redocument API_EXPORT b32 -Buffer_Kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result) +Buffer_Kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result_out) /* DOC_PARAM(buffer, The buffer parameter specifies the buffer to try to kill.) DOC_PARAM(flags, The flags parameter specifies behaviors for the buffer kill.) @@ -1620,7 +1620,7 @@ DOC_SEE(Buffer_Identifier) System_Functions *system = models->system; Working_Set *working_set = &models->working_set; Editing_File *file = imp_get_file(models, buffer_id); - *result = BufferKillResult_DoesNotExist; + Buffer_Kill_Result result = BufferKillResult_DoesNotExist; if (buffer_api_check_file(file)){ if (!file->settings.never_kill){ b32 needs_to_save = file_needs_save(file); @@ -1659,17 +1659,20 @@ DOC_SEE(Buffer_Identifier) } } - *result = BufferKillResult_Killed; + result = BufferKillResult_Killed; } else{ - *result = BufferKillResult_Dirty; + result = BufferKillResult_Dirty; } } else{ - *result = BufferKillResult_Unkillable; + result = BufferKillResult_Unkillable; } } - return(*result == BufferKillResult_Killed); + if (result_out != 0){ + *result_out = result; + } + return(result == BufferKillResult_Killed); } API_EXPORT b32 @@ -4160,7 +4163,7 @@ Finalize_Color(Application_Links *app, int_color color){ } // TODO(allen): redocument -API_EXPORT i32 +API_EXPORT b32 Get_Hot_Directory(Application_Links *app, String *out, i32 *required_size_out) /* DOC_PARAM(out, On success this character buffer is filled with the 4coder 'hot directory'.) @@ -4172,7 +4175,9 @@ DOC_SEE(directory_set_hot) Models *models = (Models*)app->cmd_context; Hot_Directory *hot = &models->hot_directory; hot_directory_clean_end(hot); - *required_size_out = hot->string.size; + if (required_size_out != 0){ + *required_size_out = hot->string.size; + } b32 result = false; if (append(out, hot->string)){ terminate_with_null(out);