From 9cfffe6bb6b083ae8c93ca6efe165dcba9c310d0 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 13 Feb 2019 15:15:22 -0800 Subject: [PATCH] File Attributes thingy, command line file crash investigated --- 4coder_API/4coder_types.h | 5 + 4coder_generated/app_functions.h | 7 + 4coder_generated/remapping.h | 50 ++- 4ed.cpp | 23 +- 4ed_api_implementation.cpp | 44 ++- 4ed_file.cpp | 26 +- 4ed_file.h | 1 + 4ed_system.h | 10 +- 4ed_working_set.cpp | 51 --- platform_all/4ed_link_system_functions.cpp | 2 +- platform_all/4ed_system_shared.cpp | 30 -- platform_win32/win32_4ed_functions.cpp | 49 ++- site/source_material/binding_list.txt | 358 --------------------- 13 files changed, 121 insertions(+), 535 deletions(-) diff --git a/4coder_API/4coder_types.h b/4coder_API/4coder_types.h index 2ad4c5e3..75fb514a 100644 --- a/4coder_API/4coder_types.h +++ b/4coder_API/4coder_types.h @@ -562,6 +562,11 @@ STRUCT Partial_Cursor{ TYPEDEF_FUNC bool32 Buffer_Edit_Handler(struct Application_Links *app, Buffer_ID buffer_id, int32_t start, int32_t one_past_last, String str); // TODO(allen): what to do with batches??? +STRUCT File_Attributes{ + uint64_t size; + uint64_t last_write_time; +}; + /* DOC(Buffer_Summary acts as a handle to a buffer and describes the state of the buffer.) DOC_SEE(Access_Flag) DOC_SEE(Dirty_State) */ diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index eba74871..637fb47d 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -29,6 +29,7 @@ struct Application_Links; #define BUFFER_SAVE_SIG(n) bool32 n(Application_Links *app, Buffer_ID buffer_id, String file_name, uint32_t flags) #define BUFFER_KILL_SIG(n) bool32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags, Buffer_Kill_Result *result) #define BUFFER_REOPEN_SIG(n) bool32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags, Buffer_Reopen_Result *result) +#define BUFFER_GET_FILE_ATTRIBUTES_SIG(n) bool32 n(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out) #define GET_VIEW_FIRST_SIG(n) bool32 n(Application_Links *app, Access_Flag access, View_ID *view_id_out) #define GET_VIEW_NEXT_SIG(n) bool32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out) #define GET_VIEW_SUMMARY_SIG(n) bool32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view_summary_out) @@ -165,6 +166,7 @@ typedef CREATE_BUFFER_SIG(Create_Buffer_Function); typedef BUFFER_SAVE_SIG(Buffer_Save_Function); typedef BUFFER_KILL_SIG(Buffer_Kill_Function); typedef BUFFER_REOPEN_SIG(Buffer_Reopen_Function); +typedef BUFFER_GET_FILE_ATTRIBUTES_SIG(Buffer_Get_File_Attributes_Function); typedef GET_VIEW_FIRST_SIG(Get_View_First_Function); typedef GET_VIEW_NEXT_SIG(Get_View_Next_Function); typedef GET_VIEW_SUMMARY_SIG(Get_View_Summary_Function); @@ -303,6 +305,7 @@ Create_Buffer_Function *create_buffer; Buffer_Save_Function *buffer_save; Buffer_Kill_Function *buffer_kill; Buffer_Reopen_Function *buffer_reopen; +Buffer_Get_File_Attributes_Function *buffer_get_file_attributes; Get_View_First_Function *get_view_first; Get_View_Next_Function *get_view_next; Get_View_Summary_Function *get_view_summary; @@ -440,6 +443,7 @@ Create_Buffer_Function *create_buffer_; Buffer_Save_Function *buffer_save_; Buffer_Kill_Function *buffer_kill_; Buffer_Reopen_Function *buffer_reopen_; +Buffer_Get_File_Attributes_Function *buffer_get_file_attributes_; Get_View_First_Function *get_view_first_; Get_View_Next_Function *get_view_next_; Get_View_Summary_Function *get_view_summary_; @@ -585,6 +589,7 @@ app_links->create_buffer_ = Create_Buffer;\ app_links->buffer_save_ = Buffer_Save;\ app_links->buffer_kill_ = Buffer_Kill;\ app_links->buffer_reopen_ = Buffer_Reopen;\ +app_links->buffer_get_file_attributes_ = Buffer_Get_File_Attributes;\ app_links->get_view_first_ = Get_View_First;\ app_links->get_view_next_ = Get_View_Next;\ app_links->get_view_summary_ = Get_View_Summary;\ @@ -722,6 +727,7 @@ static bool32 create_buffer(Application_Links *app, String file_name, Buffer_Cre static bool32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String file_name, uint32_t flags){return(app->buffer_save(app, buffer_id, file_name, flags));} static bool32 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 bool32 buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags, Buffer_Reopen_Result *result){return(app->buffer_reopen(app, buffer_id, flags, result));} +static bool32 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 bool32 get_view_first(Application_Links *app, Access_Flag access, View_ID *view_id_out){return(app->get_view_first(app, access, view_id_out));} static bool32 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));} static bool32 get_view_summary(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view_summary_out){return(app->get_view_summary(app, view_id, access, view_summary_out));} @@ -859,6 +865,7 @@ static bool32 create_buffer(Application_Links *app, String file_name, Buffer_Cre static bool32 buffer_save(Application_Links *app, Buffer_ID buffer_id, String file_name, uint32_t flags){return(app->buffer_save_(app, buffer_id, file_name, flags));} static bool32 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 bool32 buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags, Buffer_Reopen_Result *result){return(app->buffer_reopen_(app, buffer_id, flags, result));} +static bool32 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 bool32 get_view_first(Application_Links *app, Access_Flag access, View_ID *view_id_out){return(app->get_view_first_(app, access, view_id_out));} static bool32 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));} static bool32 get_view_summary(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view_summary_out){return(app->get_view_summary_(app, view_id, access, view_summary_out));} diff --git a/4coder_generated/remapping.h b/4coder_generated/remapping.h index 3e454814..c6e714fc 100644 --- a/4coder_generated/remapping.h +++ b/4coder_generated/remapping.h @@ -10,7 +10,6 @@ bind(context, 'k', MDFR_CTRL, interactive_kill_buffer); bind(context, 'i', MDFR_CTRL, interactive_switch_buffer); bind(context, 'h', MDFR_CTRL, project_go_to_root_directory); bind(context, 'S', MDFR_CTRL, save_all_dirty_buffers); -bind(context, key_print_screen, MDFR_NONE, toggle_filebar); bind(context, key_scroll_lock, MDFR_NONE, toggle_filebar); bind(context, key_pause, MDFR_NONE, toggle_filebar); bind(context, key_caps, MDFR_NONE, toggle_filebar); @@ -385,7 +384,7 @@ Meta_Sub_Map *sub_maps; int32_t sub_map_count; LINK_PROCS(void (*fill_keys_proc)(Bind_Helper *context);) }; -static Meta_Key_Bind fcoder_binds_for_default_mapid_global[44] = { +static Meta_Key_Bind fcoder_binds_for_default_mapid_global[43] = { {0, 44, 1, "change_active_panel", 19, LINK_PROCS(change_active_panel)}, {0, 60, 1, "change_active_panel_backwards", 29, LINK_PROCS(change_active_panel_backwards)}, {0, 110, 1, "interactive_new", 15, LINK_PROCS(interactive_new)}, @@ -395,7 +394,6 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[44] = { {0, 105, 1, "interactive_switch_buffer", 25, LINK_PROCS(interactive_switch_buffer)}, {0, 104, 1, "project_go_to_root_directory", 28, LINK_PROCS(project_go_to_root_directory)}, {0, 83, 1, "save_all_dirty_buffers", 22, LINK_PROCS(save_all_dirty_buffers)}, -{0, 55316, 0, "toggle_filebar", 14, LINK_PROCS(toggle_filebar)}, {0, 55315, 0, "toggle_filebar", 14, LINK_PROCS(toggle_filebar)}, {0, 55308, 0, "toggle_filebar", 14, LINK_PROCS(toggle_filebar)}, {0, 55313, 0, "toggle_filebar", 14, LINK_PROCS(toggle_filebar)}, @@ -412,6 +410,7 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[44] = { {0, 88, 2, "project_command_lister", 22, LINK_PROCS(project_command_lister)}, {0, 73, 1, "list_all_functions_all_buffers_lister", 37, LINK_PROCS(list_all_functions_all_buffers_lister)}, {0, 69, 2, "exit_4coder", 11, LINK_PROCS(exit_4coder)}, +{0, 55325, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55326, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55327, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55328, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, @@ -427,16 +426,15 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[44] = { {0, 55338, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55339, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55340, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, -{0, 55341, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, -{0, 55321, 0, "mouse_wheel_scroll", 18, LINK_PROCS(mouse_wheel_scroll)}, -{0, 55321, 1, "mouse_wheel_change_face_size", 28, LINK_PROCS(mouse_wheel_change_face_size)}, +{0, 55320, 0, "mouse_wheel_scroll", 18, LINK_PROCS(mouse_wheel_scroll)}, +{0, 55320, 1, "mouse_wheel_change_face_size", 28, LINK_PROCS(mouse_wheel_change_face_size)}, }; static Meta_Key_Bind fcoder_binds_for_default_mapid_file[78] = { {1, 0, 0, "write_character", 15, LINK_PROCS(write_character)}, -{0, 55317, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, -{0, 55324, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, -{0, 55319, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)}, -{0, 55322, 0, "click_set_cursor_if_lbutton", 27, LINK_PROCS(click_set_cursor_if_lbutton)}, +{0, 55316, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, +{0, 55323, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, +{0, 55318, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)}, +{0, 55321, 0, "click_set_cursor_if_lbutton", 27, LINK_PROCS(click_set_cursor_if_lbutton)}, {0, 55301, 0, "delete_char", 11, LINK_PROCS(delete_char)}, {0, 55301, 8, "delete_char", 11, LINK_PROCS(delete_char)}, {0, 55296, 0, "backspace_char", 14, LINK_PROCS(backspace_char)}, @@ -556,14 +554,14 @@ static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[16] = { {0, 55298, 0, "lister__move_down", 17, LINK_PROCS(lister__move_down)}, {0, 106, 2, "lister__move_down", 17, LINK_PROCS(lister__move_down)}, {0, 55306, 0, "lister__move_down", 17, LINK_PROCS(lister__move_down)}, -{0, 55321, 0, "lister__wheel_scroll", 20, LINK_PROCS(lister__wheel_scroll)}, -{0, 55317, 0, "lister__mouse_press", 19, LINK_PROCS(lister__mouse_press)}, -{0, 55319, 0, "lister__mouse_release", 21, LINK_PROCS(lister__mouse_release)}, +{0, 55320, 0, "lister__wheel_scroll", 20, LINK_PROCS(lister__wheel_scroll)}, +{0, 55316, 0, "lister__mouse_press", 19, LINK_PROCS(lister__mouse_press)}, +{0, 55318, 0, "lister__mouse_release", 21, LINK_PROCS(lister__mouse_release)}, +{0, 55321, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)}, {0, 55322, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)}, -{0, 55323, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)}, }; static Meta_Sub_Map fcoder_submaps_for_default[4] = { -{"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_default_mapid_global, 44}, +{"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_default_mapid_global, 43}, {"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_default_mapid_file, 78}, {"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_default_default_code_map, 31}, {"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_default_default_lister_ui_map, 16}, @@ -591,6 +589,7 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[40] = { {0, 88, 1, "project_command_lister", 22, LINK_PROCS(project_command_lister)}, {0, 73, 4, "list_all_functions_all_buffers_lister", 37, LINK_PROCS(list_all_functions_all_buffers_lister)}, {0, 69, 1, "exit_4coder", 11, LINK_PROCS(exit_4coder)}, +{0, 55325, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55326, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55327, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55328, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, @@ -606,17 +605,16 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[40] = { {0, 55338, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55339, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, {0, 55340, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, -{0, 55341, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)}, -{0, 55321, 0, "mouse_wheel_scroll", 18, LINK_PROCS(mouse_wheel_scroll)}, -{0, 55321, 4, "mouse_wheel_change_face_size", 28, LINK_PROCS(mouse_wheel_change_face_size)}, +{0, 55320, 0, "mouse_wheel_scroll", 18, LINK_PROCS(mouse_wheel_scroll)}, +{0, 55320, 4, "mouse_wheel_change_face_size", 28, LINK_PROCS(mouse_wheel_change_face_size)}, }; static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_file[77] = { {1, 0, 0, "write_character", 15, LINK_PROCS(write_character)}, {1, 0, 2, "write_character", 15, LINK_PROCS(write_character)}, -{0, 55317, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, -{0, 55324, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, -{0, 55319, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)}, -{0, 55322, 0, "click_set_cursor_if_lbutton", 27, LINK_PROCS(click_set_cursor_if_lbutton)}, +{0, 55316, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, +{0, 55323, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)}, +{0, 55318, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)}, +{0, 55321, 0, "click_set_cursor_if_lbutton", 27, LINK_PROCS(click_set_cursor_if_lbutton)}, {0, 55301, 0, "delete_char", 11, LINK_PROCS(delete_char)}, {0, 55301, 8, "delete_char", 11, LINK_PROCS(delete_char)}, {0, 55296, 0, "backspace_char", 14, LINK_PROCS(backspace_char)}, @@ -732,11 +730,11 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_lister_ui_map[14] = { {0, 55305, 0, "lister__move_up", 15, LINK_PROCS(lister__move_up)}, {0, 55298, 0, "lister__move_down", 17, LINK_PROCS(lister__move_down)}, {0, 55306, 0, "lister__move_down", 17, LINK_PROCS(lister__move_down)}, -{0, 55321, 0, "lister__wheel_scroll", 20, LINK_PROCS(lister__wheel_scroll)}, -{0, 55317, 0, "lister__mouse_press", 19, LINK_PROCS(lister__mouse_press)}, -{0, 55319, 0, "lister__mouse_release", 21, LINK_PROCS(lister__mouse_release)}, +{0, 55320, 0, "lister__wheel_scroll", 20, LINK_PROCS(lister__wheel_scroll)}, +{0, 55316, 0, "lister__mouse_press", 19, LINK_PROCS(lister__mouse_press)}, +{0, 55318, 0, "lister__mouse_release", 21, LINK_PROCS(lister__mouse_release)}, +{0, 55321, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)}, {0, 55322, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)}, -{0, 55323, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)}, }; static Meta_Sub_Map fcoder_submaps_for_mac_default[4] = { {"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_mac_default_mapid_global, 40}, diff --git a/4ed.cpp b/4ed.cpp index 6742ce15..21470af2 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -891,7 +891,8 @@ App_Init_Sig(app_init){ init_read_only_file(system, models, file); } else{ - init_normal_file(system, models, 0, 0, file); + File_Attributes attributes = {}; + init_normal_file(system, models, 0, 0, attributes, file); } file->settings.never_kill = true; @@ -988,24 +989,26 @@ App_Step_Sig(app_step){ if (input->first_step){ // Open command line files. char space[512]; - String cl_filename = make_fixed_width_string(space); - copy_ss(&cl_filename, models->hot_directory.string); - i32 cl_filename_len = cl_filename.size; + String cl_file_name = make_fixed_width_string(space); + copy_ss(&cl_file_name, models->hot_directory.string); + i32 cl_file_name_len = cl_file_name.size; for (i32 i = 0; i < models->settings.init_files_count; ++i){ - cl_filename.size = cl_filename_len; + cl_file_name.size = cl_file_name_len; - String filename = {}; + String file_name = {}; Editing_File_Name canon_name = {}; if (get_canon_name(system, make_string_slowly(models->settings.init_files[i]), &canon_name)){ - filename = canon_name.name; + file_name = canon_name.name; } else{ - append_sc(&cl_filename, models->settings.init_files[i]); - filename = cl_filename; + append_sc(&cl_file_name, models->settings.init_files[i]); + file_name = cl_file_name; } - open_file(system, models, filename); + //open_file(system, models, file_name); + Buffer_ID id = 0; + create_buffer(&models->app_links, file_name, 0, &id); } if (models->hook_start != 0){ diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index e52009ba..86c8c36e 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -1255,32 +1255,31 @@ DOC_SEE(Buffer_Create_Flag) file_bind_file_name(system, heap, working_set, file, canon.name); } buffer_bind_name(models, heap, part, working_set, file, front_of_directory(file_name)); - init_normal_file(system, models, 0, 0, file); + File_Attributes attributes = {}; + init_normal_file(system, models, 0, 0, attributes, file); *new_buffer_id_out = file->id.id; result = true; } } } else{ - Assert(!handle_equal(handle, null_plat_handle)); - - i32 size = system->load_size(handle); + File_Attributes attributes = system->load_attributes(handle); b32 in_heap_mem = false; - char *buffer = push_array(part, char, size); + char *buffer = push_array(part, char, (i32)attributes.size); if (buffer == 0){ - buffer = heap_array(heap, char, size); + buffer = heap_array(heap, char, (i32)attributes.size); Assert(buffer != 0); in_heap_mem = true; } - if (system->load_file(handle, buffer, size)){ + if (system->load_file(handle, buffer, (i32)attributes.size)){ system->load_close(handle); file = working_set_alloc_always(working_set, heap, &models->lifetime_allocator); if (file != 0){ file_bind_file_name(system, heap, working_set, file, canon.name); buffer_bind_name(models, heap, part, working_set, file, front_of_directory(file_name)); - init_normal_file(system, models, buffer, size, file); + init_normal_file(system, models, buffer, (i32)attributes.size, attributes, file); *new_buffer_id_out = file->id.id; result = true; } @@ -1316,11 +1315,9 @@ DOC_SEE(Buffer_Create_Flag) } } - if (file != 0 && buffer_is_for_new_file && - (flags & BufferCreate_SuppressNewFileHook) == 0){ - if (models->hook_new_file != 0){ - models->hook_new_file(&models->app_links, file->id.id); - } + if (file != 0 && buffer_is_for_new_file && (flags & BufferCreate_SuppressNewFileHook) == 0 && + models->hook_new_file != 0){ + models->hook_new_file(&models->app_links, file->id.id); } end_temp_memory(temp); @@ -1450,14 +1447,14 @@ Buffer_Reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl if (file->canon.name.str != 0 && file->canon.name.size != 0){ Plat_Handle handle = {}; if (system->load_handle(file->canon.name.str, &handle)){ - i32 size = system->load_size(handle); + File_Attributes attributes = system->load_attributes(handle); Partition *part = &models->mem.part; Temp_Memory temp = begin_temp_memory(part); - char *file_memory = push_array(part, char, size); + char *file_memory = push_array(part, char, (i32)attributes.size); if (file_memory != 0){ - if (system->load_file(handle, file_memory, size)){ + if (system->load_file(handle, file_memory, (i32)attributes.size)){ system->load_close(handle); // TODO(allen): try(perform a diff maybe apply edits in reopen) @@ -1486,7 +1483,7 @@ Buffer_Reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl file_free(system, &models->mem.heap, &models->lifetime_allocator, file); working_set_file_default_settings(&models->working_set, file); - init_normal_file(system, models, file_memory, size, file); + init_normal_file(system, models, file_memory, (i32)attributes.size, attributes, file); for (i32 i = 0; i < vptr_count; ++i){ view_set_file(system, models, vptrs[i], file); @@ -1515,6 +1512,19 @@ Buffer_Reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl return(*result == BufferReopenResult_Reopened); } +API_EXPORT bool32 +Buffer_Get_File_Attributes(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out) +{ + Models *models = (Models*)app->cmd_context; + Editing_File *file = imp_get_file(models, buffer_id); + if (buffer_api_check_file(file)){ + block_copy(attributes_out, &file->attributes, sizeof(*attributes_out)); + return(true); + } + block_zero_struct(attributes_out); + return(false); +} + internal View* get_view_next__inner(Layout *layout, View *view){ if (view != 0){ diff --git a/4ed_file.cpp b/4ed_file.cpp index c4500b75..0bf0779c 100644 --- a/4ed_file.cpp +++ b/4ed_file.cpp @@ -181,10 +181,12 @@ save_file_to_name(System_Functions *system, Models *models, Editing_File *file, } } - result = system->save_file(file_name, data, size); - - if (result && using_actual_file_name){ - file->state.ignore_behind_os = 1; + File_Attributes new_attributes = system->save_file(file_name, data, size); + if (new_attributes.last_write_time > 0){ + if (using_actual_file_name){ + file->state.ignore_behind_os = 1; + } + file->attributes = new_attributes; } file_set_dirty_flag(file, DirtyState_UpToDate); @@ -413,12 +415,12 @@ file_allocate_wrap_positions_as_needed(Heap *heap, Editing_File *file, i32 min_l //////////////////////////////// internal void -file_create_from_string(System_Functions *system, Models *models, Editing_File *file, String val, u32 flags){ +file_create_from_string(System_Functions *system, Models *models, Editing_File *file, String val, File_Attributes attributes, u32 flags){ Heap *heap = &models->mem.heap; Partition *part = &models->mem.part; Application_Links *app_links = &models->app_links; - memset(&file->state, 0, sizeof(file->state)); + block_zero_struct(&file->state); Gap_Buffer_Init init = buffer_begin_init(&file->state.buffer, val.str, val.size); for (; buffer_init_need_more(&init); ){ i32 page_size = buffer_init_page_size(&init); @@ -436,9 +438,10 @@ file_create_from_string(System_Functions *system, Models *models, Editing_File * AllowLocal(init_success); Assert(init_success); if (buffer_size(&file->state.buffer) < val.size){ - file->settings.dos_write_mode = 1; + file->settings.dos_write_mode = true; } file_set_dirty_flag(file, DirtyState_UpToDate); + file->attributes = attributes; Face_ID font_id = models->global_font_id; file->settings.font_id = font_id; @@ -515,15 +518,16 @@ file_free(System_Functions *system, Heap *heap, Lifetime_Allocator *lifetime_all } internal void -init_normal_file(System_Functions *system, Models *models, char *buffer, i32 size, Editing_File *file){ +init_normal_file(System_Functions *system, Models *models, char *buffer, i32 size, File_Attributes attributes, Editing_File *file){ String val = make_string(buffer, size); - file_create_from_string(system, models, file, val, 0); + file_create_from_string(system, models, file, val, attributes, 0); } internal void init_read_only_file(System_Functions *system, Models *models, Editing_File *file){ - String val = null_string; - file_create_from_string(system, models, file, val, FileCreateFlag_ReadOnly); + String val = {}; + File_Attributes attributes = {}; + file_create_from_string(system, models, file, val, attributes, FileCreateFlag_ReadOnly); } //////////////////////////////// diff --git a/4ed_file.h b/4ed_file.h index ff86ab40..560b7057 100644 --- a/4ed_file.h +++ b/4ed_file.h @@ -106,6 +106,7 @@ struct Editing_File{ b32 is_loading; b32 is_dummy; Editing_File_State state; + File_Attributes attributes; Lifetime_Object *lifetime_object; Editing_File_Name base_name; Editing_File_Name unique_name; diff --git a/4ed_system.h b/4ed_system.h index ca22608a..df5f1f63 100644 --- a/4ed_system.h +++ b/4ed_system.h @@ -17,8 +17,6 @@ struct Plat_Handle{ u32 d[4]; }; -static Plat_Handle null_plat_handle = {}; - internal b32 handle_equal(Plat_Handle a, Plat_Handle b){ b32 result = (memcmp(&a, &b, sizeof(a)) == 0); @@ -36,8 +34,8 @@ typedef Sys_Get_Canonical_Sig(System_Get_Canonical); #define Sys_Load_Handle_Sig(name) b32 name(char *filename, Plat_Handle *handle_out) typedef Sys_Load_Handle_Sig(System_Load_Handle); -#define Sys_Load_Size_Sig(name) u32 name(Plat_Handle handle) -typedef Sys_Load_Size_Sig(System_Load_Size); +#define Sys_Load_Attributes_Sig(name) File_Attributes name(Plat_Handle handle) +typedef Sys_Load_Attributes_Sig(System_Load_Attributes); #define Sys_Load_File_Sig(name) b32 name(Plat_Handle handle, char *buffer, u32 size) typedef Sys_Load_File_Sig(System_Load_File); @@ -45,7 +43,7 @@ typedef Sys_Load_File_Sig(System_Load_File); #define Sys_Load_Close_Sig(name) b32 name(Plat_Handle handle) typedef Sys_Load_Close_Sig(System_Load_Close); -#define Sys_Save_File_Sig(name) b32 name(char *filename, char *buffer, u32 size) +#define Sys_Save_File_Sig(name) File_Attributes name(char *filename, char *buffer, u32 size) typedef Sys_Save_File_Sig(System_Save_File); // file changes @@ -239,7 +237,7 @@ struct System_Functions{ System_Remove_Listener *remove_listener; System_Get_File_Change *get_file_change; System_Load_Handle *load_handle; - System_Load_Size *load_size; + System_Load_Attributes *load_attributes; System_Load_File *load_file; System_Load_Close *load_close; System_Save_File *save_file; diff --git a/4ed_working_set.cpp b/4ed_working_set.cpp index 87b8c6c0..4497d307 100644 --- a/4ed_working_set.cpp +++ b/4ed_working_set.cpp @@ -567,57 +567,6 @@ buffer_bind_name(Models *models, Heap *heap, Partition *scratch, //////////////////////////////// -internal Editing_File* -open_file(System_Functions *system, Models *models, String file_name){ - Editing_File *file = 0; - Editing_File_Name canon_name = {}; - - if (terminate_with_null(&file_name) && - get_canon_name(system, file_name, &canon_name)){ - Working_Set *working_set = &models->working_set; - file = working_set_contains_canon(working_set, canon_name.name); - if (file == 0){ - Plat_Handle handle; - if (system->load_handle(canon_name.name.str, &handle)){ - Mem_Options *mem = &models->mem; - Heap *heap = &mem->heap; - Partition *part = &mem->part; - - file = working_set_alloc_always(working_set, heap, &models->lifetime_allocator); - file_bind_file_name(system, heap, working_set, file, canon_name.name); - buffer_bind_name(models, heap, part, working_set, file, front_of_directory(file_name)); - - Temp_Memory temp = begin_temp_memory(part); - - i32 size = system->load_size(handle); - char *buffer = push_array(part, char, size); - b32 gen_buffer = false; - if (buffer == 0){ - buffer = heap_array(heap, char, size); - Assert(buffer != 0); - gen_buffer = true; - } - - b32 good_load = system->load_file(handle, buffer, size); - system->load_close(handle); - if (good_load){ - init_normal_file(system, models, buffer, size, file); - } - - if (gen_buffer){ - heap_free(heap, buffer); - } - - end_temp_memory(temp); - } - } - } - - return(file); -} - -//////////////////////////////// - internal void file_touch(Working_Set *working_set, Editing_File *file){ Assert(file != 0); diff --git a/platform_all/4ed_link_system_functions.cpp b/platform_all/4ed_link_system_functions.cpp index 71f4c543..c6bb4864 100644 --- a/platform_all/4ed_link_system_functions.cpp +++ b/platform_all/4ed_link_system_functions.cpp @@ -21,7 +21,7 @@ link_system_code(){ SYSLINK(remove_listener); SYSLINK(get_file_change); SYSLINK(load_handle); - SYSLINK(load_size); + SYSLINK(load_attributes); SYSLINK(load_file); SYSLINK(load_close); SYSLINK(save_file); diff --git a/platform_all/4ed_system_shared.cpp b/platform_all/4ed_system_shared.cpp index 6cfcf691..54b09026 100644 --- a/platform_all/4ed_system_shared.cpp +++ b/platform_all/4ed_system_shared.cpp @@ -41,36 +41,6 @@ init_shared_vars(){ // General shared pieces // -internal File_Data -sysshared_load_file(char *filename){ - File_Data result = {}; - - Plat_Handle handle = {}; - if (system_load_handle(filename, &handle)){ - u32 size = system_load_size(handle); - - result.got_file = 1; - if (size > 0){ - result.size = size; - result.data = (char*)system_memory_allocate(size+1); - - if (!result.data){ - result = null_file_data; - } - else{ - if (!system_load_file(handle, result.data, size)){ - system_memory_free(result.data, size+1); - result = null_file_data; - } - } - } - - system_load_close(handle); - } - - return(result); -} - internal void sysshared_filter_real_files(char **files, i32 *file_count){ i32 end = *file_count; diff --git a/platform_win32/win32_4ed_functions.cpp b/platform_win32/win32_4ed_functions.cpp index 89cefda7..cfe0f0af 100644 --- a/platform_win32/win32_4ed_functions.cpp +++ b/platform_win32/win32_4ed_functions.cpp @@ -334,79 +334,78 @@ Sys_Get_Canonical_Sig(system_get_canonical){ return(result); } +internal File_Attributes +win32_file_attributes_from_HANDLE(HANDLE file){ + BY_HANDLE_FILE_INFORMATION info = {}; + GetFileInformationByHandle(file, &info); + File_Attributes result = {}; + result.size = ((u64)info.nFileSizeHigh << 32LL) | ((u64)info.nFileSizeLow); + result.last_write_time = ((u64)info.ftLastWriteTime.dwHighDateTime << 32LL) | ((u64)info.ftLastWriteTime.dwLowDateTime); + return(result); +} + internal Sys_Load_Handle_Sig(system_load_handle){ b32 result = false; HANDLE file = CreateFile_utf8(&shared_vars.scratch, (u8*)filename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); - if (file != INVALID_HANDLE_VALUE){ *(HANDLE*)handle_out = file; result = true; } - return(result); } internal -Sys_Load_Size_Sig(system_load_size){ - u32 result = 0; +Sys_Load_Attributes_Sig(system_load_attributes){ HANDLE file = *(HANDLE*)(&handle); - - DWORD hi = 0; - DWORD lo = GetFileSize(file, &hi); - - if (hi == 0){ - result = lo; - } - - return(result); + return(win32_file_attributes_from_HANDLE(file)); } internal Sys_Load_File_Sig(system_load_file){ - b32 result = 0; HANDLE file = *(HANDLE*)(&handle); - DWORD read_size = 0; - + b32 result = false; if (ReadFile(file, buffer, size, &read_size, 0)){ if (read_size == size){ - result = 1; + result = true; } } - return(result); } internal Sys_Load_Close_Sig(system_load_close){ - b32 result = 0; + b32 result = false; HANDLE file = *(HANDLE*)(&handle); if (CloseHandle(file)){ - result = 1; + result = true; } return(result); } internal Sys_Save_File_Sig(system_save_file){ - b32 result = false; + File_Attributes result = {}; HANDLE file = CreateFile_utf8(&shared_vars.scratch, (u8*)filename, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (file != INVALID_HANDLE_VALUE){ DWORD written_total = 0; DWORD written_size = 0; - result = true; - - while (written_total < size){ + b32 success = true; + for (;written_total < size;){ if (!WriteFile(file, buffer + written_total, size - written_total, &written_size, 0)){ - result = 0; + success = false; break; } written_total += written_size; } + if (success){ + result = win32_file_attributes_from_HANDLE(file); + } + CloseHandle(file); } diff --git a/site/source_material/binding_list.txt b/site/source_material/binding_list.txt index af861a46..986d75e0 100644 --- a/site/source_material/binding_list.txt +++ b/site/source_material/binding_list.txt @@ -20,361 +20,3 @@ The following bindings apply in all situations. \ITEM \STYLE{code} \END Interactively switch to an open buffer. \ITEM \STYLE{code} \END Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns. \ITEM \STYLE{code} \END Saves all buffers marked dirty (showing the '*' indicator). -\ITEM \STYLE{code} \END If the special build panel is open, makes the build panel the active panel. -\ITEM \STYLE{code} \END If the special build panel is open, closes it. -\ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations. -\ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations. -\ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the first jump in the buffer. -\ITEM \STYLE{code} \END Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view. -\ITEM \STYLE{code} \END Toggles the visibility status of the current view's filebar. -\ITEM \STYLE{code} \END Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer. -\ITEM \STYLE{code} \END If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command. -\ITEM \STYLE{code} \END Opens an interactive list of all registered commands. -\ITEM \STYLE{code} \END Open a lister of all commands in the currently loaded project. -\ITEM \STYLE{code} \END Creates a lister of locations that look like function definitions and declarations all buffers. -\ITEM \STYLE{code} \END Attempts to close 4coder. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END Reads the scroll wheel value from the mouse state and scrolls accordingly. -\ITEM \STYLE{code} \END Reads the state of the mouse wheel and uses it to either increase or decrease the face size. -\END -\END -\SECTION{mapid-file} -The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files. -\LIST -\ITEM \STYLE{code} \END Inserts whatever character was used to trigger this command. -\ITEM \STYLE{code} \END Sets the cursor position and mark to the mouse position. -\ITEM \STYLE{code} \END Sets the cursor position and mark to the mouse position. -\ITEM \STYLE{code} \END Sets the cursor position to the mouse position. -\ITEM \STYLE{code} \END If the mouse left button is pressed, sets the cursor position to the mouse position. -\ITEM \STYLE{code} \END Deletes the character to the right of the cursor. -\ITEM \STYLE{code} \END Deletes the character to the right of the cursor. -\ITEM \STYLE{code} \END Deletes the character to the left of the cursor. -\ITEM \STYLE{code} \END Deletes the character to the left of the cursor. -\ITEM \STYLE{code} \END Moves the cursor up one line. -\ITEM \STYLE{code} \END Moves the cursor down one line. -\ITEM \STYLE{code} \END Moves the cursor one character to the left. -\ITEM \STYLE{code} \END Moves the cursor one character to the right. -\ITEM \STYLE{code} \END Moves the cursor up one line. -\ITEM \STYLE{code} \END Moves the cursor down one line. -\ITEM \STYLE{code} \END Moves the cursor one character to the left. -\ITEM \STYLE{code} \END Moves the cursor one character to the right. -\ITEM \STYLE{code} \END Seeks the cursor to the end of the visual line. -\ITEM \STYLE{code} \END Seeks the cursor to the beginning of the visual line. -\ITEM \STYLE{code} \END Sets the cursor to the beginning of the file. -\ITEM \STYLE{code} \END Sets the cursor to the end of the file. -\ITEM \STYLE{code} \END Scrolls the view up one view height and moves the cursor up one view height. -\ITEM \STYLE{code} \END Scrolls the view down one view height and moves the cursor down one view height. -\ITEM \STYLE{code} \END Seeks the cursor to the end of the visual line. -\ITEM \STYLE{code} \END Seeks the cursor to the beginning of the visual line. -\ITEM \STYLE{code} \END Sets the cursor to the beginning of the file. -\ITEM \STYLE{code} \END Sets the cursor to the end of the file. -\ITEM \STYLE{code} \END Scrolls the view up one view height and moves the cursor up one view height. -\ITEM \STYLE{code} \END Scrolls the view down one view height and moves the cursor down one view height. -\ITEM \STYLE{code} \END Seeks the cursor up to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seeks the cursor down to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seek left for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Seek right for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Seeks the cursor up to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seeks the cursor down to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seek left for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Seek right for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Swaps the line under the cursor with the line above it, and moves the cursor up with it. -\ITEM \STYLE{code} \END Swaps the line under the cursor with the line below it, and moves the cursor down with it. -\ITEM \STYLE{code} \END Delete characters between the cursor position and the first alphanumeric boundary to the left. -\ITEM \STYLE{code} \END Delete characters between the cursor position and the first alphanumeric boundary to the right. -\ITEM \STYLE{code} \END Delete a single, whole token on or to the left of the cursor and post it to the clipboard. -\ITEM \STYLE{code} \END Delete a single, whole token on or to the right of the cursor and post it to the clipboard. -\ITEM \STYLE{code} \END Sets the mark to the current position of the cursor. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END Copy the text in the range from the cursor to the mark onto the clipboard. -\ITEM \STYLE{code} \END Deletes the text in the range between the cursor and the mark. -\ITEM \STYLE{code} \END Delete the line the on which the cursor sits. -\ITEM \STYLE{code} \END Centers the view vertically on the line on which the cursor sits. -\ITEM \STYLE{code} \END Sets the left size of the view near the x position of the cursor. -\ITEM \STYLE{code} \END Begins an incremental search down through the current buffer for a user specified string. -\ITEM \STYLE{code} \END Queries the user for a string and lists all exact case-sensitive matches found in all open buffers. -\ITEM \STYLE{code} \END Queries the user for a string and lists all case-insensitive substring matches found in all open buffers. -\ITEM \STYLE{code} \END Queries the user for a number, and jumps the cursor to the corresponding line. -\ITEM \STYLE{code} \END Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers. -\ITEM \STYLE{code} \END Opens a snippet lister for inserting whole pre-written snippets of text. -\ITEM \STYLE{code} \END Kills the current buffer. -\ITEM \STYLE{code} \END Create a copy of the line on which the cursor sits. -\ITEM \STYLE{code} \END Swaps the position of the cursor and the mark. -\ITEM \STYLE{code} \END Reopen the current buffer from the hard drive. -\ITEM \STYLE{code} \END Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string. -\ITEM \STYLE{code} \END Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string. -\ITEM \STYLE{code} \END Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string. -\ITEM \STYLE{code} \END Begins an incremental search up through the current buffer for a user specified string. -\ITEM \STYLE{code} \END Saves the current buffer. -\ITEM \STYLE{code} \END Begins an incremental search down through the current buffer for the word or token under the cursor. -\ITEM \STYLE{code} \END Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers. -\ITEM \STYLE{code} \END Paste from the top of clipboard and run auto-indent on the newly pasted text. -\ITEM \STYLE{code} \END Paste the next item on the clipboard and run auto-indent on the newly pasted text. -\ITEM \STYLE{code} \END Cut the text in the range from the cursor to the mark onto the clipboard. -\ITEM \STYLE{code} \END Advances forewards through the undo history. -\ITEM \STYLE{code} \END Advances backwards through the undo history. -\ITEM \STYLE{code} \END Set the other non-active panel to view the buffer that the active panel views, and switch to that panel. -\ITEM \STYLE{code} \END Set the other non-active panel to view the buffer that the active panel views, and switch to that panel. -\ITEM \STYLE{code} \END If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor. -\ITEM \STYLE{code} \END If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel. -\ITEM \STYLE{code} > \END When executed on a buffer with jumps, creates a persistent lister for all the jumps -\ITEM \STYLE{code} \END Inserts whatever character was used to trigger this command. -\END -\END -\SECTION{default-code-map} -The following commands only apply in files where the lexer (syntax highlighting) is turned on. -\LIST -\ITEM \STYLE{code} \END Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters. -\ITEM \STYLE{code} \END Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters. -\ITEM \STYLE{code} \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <}> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <)> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <]> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <;> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <#> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} \END Turns uncommented lines into commented lines and vice versa for comments starting with '//'. -\ITEM \STYLE{code} \END Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string. -\ITEM \STYLE{code} \END Auto-indents the range between the cursor and the mark. -\ITEM \STYLE{code} \END Auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} \END At the cursor, insert a block comment. -\ITEM \STYLE{code} \END At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder. -\ITEM \STYLE{code} \END At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder. -\ITEM \STYLE{code} \END Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string. -\ITEM \STYLE{code} \END Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it. -\ITEM \STYLE{code} \END At the cursor, insert a '{' and '}' separated by a blank line. -\ITEM \STYLE{code} \END At the cursor, insert a '{' and '};' separated by a blank line. -\ITEM \STYLE{code} \END At the cursor, insert a '{' and '}break;' separated by a blank line. -\ITEM \STYLE{code} \END Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'. -\ITEM \STYLE{code} \END Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'. -\ITEM \STYLE{code} \END Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'. -\ITEM \STYLE{code} \END Wraps the code contained in the range between cursor and mark with a new curly brace scope. -\ITEM \STYLE{code} \END Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END Surround the range between the cursor and mark with an '#if 0' and an '#endif' -\ITEM \STYLE{code} \END Reads a filename from surrounding '"' characters and attempts to open the corresponding file. -\ITEM \STYLE{code} \END If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view. -\ITEM \STYLE{code} \END At the cursor, insert a ' = {};'. -\END -\END -\SECTION{default-lister-ui-map} -These commands apply in 'lister mode' such as when you open a file. -\LIST -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's write character handler. -\ITEM \STYLE{code} \END A lister mode command that quits the list without executing any actions. -\ITEM \STYLE{code} \END A lister mode command that activates the list's action on the highlighted item. -\ITEM \STYLE{code} \END A lister mode command that activates the list's action on the highlighted item. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's backspace text field handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate up handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate up handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate up handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate down handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate down handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate down handler. -\ITEM \STYLE{code} \END A lister mode command that scrolls the list in response to the mouse wheel. -\ITEM \STYLE{code} \END A lister mode command that beings a click interaction with a list item under the mouse. -\ITEM \STYLE{code} \END A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it. -\ITEM \STYLE{code} \END A lister mode command that updates the lists UI data. -\ITEM \STYLE{code} \END A lister mode command that updates the lists UI data. -\END -\END -\END -\SECTION{Map: mac-default} -\SECTION{mapid-global} -The following bindings apply in all situations. -\LIST -\ITEM \STYLE{code} \END Change the currently active panel, moving to the panel with the next highest view_id. -\ITEM \STYLE{code} \END Change the currently active panel, moving to the panel with the next lowest view_id. -\ITEM \STYLE{code} \END Interactively creates a new file. -\ITEM \STYLE{code} \END Interactively open a file out of the file system. -\ITEM \STYLE{code} \END Interactively opens a file in the other panel. -\ITEM \STYLE{code} \END Interactively kill an open buffer. -\ITEM \STYLE{code} \END Interactively switch to an open buffer. -\ITEM \STYLE{code} \END Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns. -\ITEM \STYLE{code} \END Saves all buffers marked dirty (showing the '*' indicator). -\ITEM \STYLE{code} \END If the special build panel is open, makes the build panel the active panel. -\ITEM \STYLE{code} \END If the special build panel is open, closes it. -\ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations. -\ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations. -\ITEM \STYLE{code} \END If a buffer containing jump locations has been locked in, goes to the first jump in the buffer. -\ITEM \STYLE{code} \END Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view. -\ITEM \STYLE{code} \END Toggles the visibility status of the current view's filebar. -\ITEM \STYLE{code} \END Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer. -\ITEM \STYLE{code} \END If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command. -\ITEM \STYLE{code} \END Opens an interactive list of all registered commands. -\ITEM \STYLE{code} \END Open a lister of all commands in the currently loaded project. -\ITEM \STYLE{code} \END Creates a lister of locations that look like function definitions and declarations all buffers. -\ITEM \STYLE{code} \END Attempts to close 4coder. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END Reads the scroll wheel value from the mouse state and scrolls accordingly. -\ITEM \STYLE{code} \END Reads the state of the mouse wheel and uses it to either increase or decrease the face size. -\END -\END -\SECTION{mapid-file} -The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files. -\LIST -\ITEM \STYLE{code} \END Inserts whatever character was used to trigger this command. -\ITEM \STYLE{code} \END Inserts whatever character was used to trigger this command. -\ITEM \STYLE{code} \END Sets the cursor position and mark to the mouse position. -\ITEM \STYLE{code} \END Sets the cursor position and mark to the mouse position. -\ITEM \STYLE{code} \END Sets the cursor position to the mouse position. -\ITEM \STYLE{code} \END If the mouse left button is pressed, sets the cursor position to the mouse position. -\ITEM \STYLE{code} \END Deletes the character to the right of the cursor. -\ITEM \STYLE{code} \END Deletes the character to the right of the cursor. -\ITEM \STYLE{code} \END Deletes the character to the left of the cursor. -\ITEM \STYLE{code} \END Deletes the character to the left of the cursor. -\ITEM \STYLE{code} \END Moves the cursor up one line. -\ITEM \STYLE{code} \END Moves the cursor down one line. -\ITEM \STYLE{code} \END Moves the cursor one character to the left. -\ITEM \STYLE{code} \END Moves the cursor one character to the right. -\ITEM \STYLE{code} \END Moves the cursor up one line. -\ITEM \STYLE{code} \END Moves the cursor down one line. -\ITEM \STYLE{code} \END Moves the cursor one character to the left. -\ITEM \STYLE{code} \END Moves the cursor one character to the right. -\ITEM \STYLE{code} \END Seeks the cursor to the end of the visual line. -\ITEM \STYLE{code} \END Seeks the cursor to the beginning of the visual line. -\ITEM \STYLE{code} \END Sets the cursor to the beginning of the file. -\ITEM \STYLE{code} \END Sets the cursor to the end of the file. -\ITEM \STYLE{code} \END Scrolls the view up one view height and moves the cursor up one view height. -\ITEM \STYLE{code} \END Scrolls the view down one view height and moves the cursor down one view height. -\ITEM \STYLE{code} \END Seeks the cursor to the end of the visual line. -\ITEM \STYLE{code} \END Seeks the cursor to the beginning of the visual line. -\ITEM \STYLE{code} \END Sets the cursor to the beginning of the file. -\ITEM \STYLE{code} \END Sets the cursor to the end of the file. -\ITEM \STYLE{code} \END Scrolls the view up one view height and moves the cursor up one view height. -\ITEM \STYLE{code} \END Scrolls the view down one view height and moves the cursor down one view height. -\ITEM \STYLE{code} \END Seeks the cursor up to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seeks the cursor down to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seek left for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Seek right for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Seeks the cursor up to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seeks the cursor down to the next blank line and places it at the end of the line. -\ITEM \STYLE{code} \END Seek left for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Seek right for the next boundary between whitespace and non-whitespace. -\ITEM \STYLE{code} \END Swaps the line under the cursor with the line above it, and moves the cursor up with it. -\ITEM \STYLE{code} \END Swaps the line under the cursor with the line below it, and moves the cursor down with it. -\ITEM \STYLE{code} \END Delete characters between the cursor position and the first alphanumeric boundary to the left. -\ITEM \STYLE{code} \END Delete characters between the cursor position and the first alphanumeric boundary to the right. -\ITEM \STYLE{code} \END Delete a single, whole token on or to the left of the cursor and post it to the clipboard. -\ITEM \STYLE{code} \END Delete a single, whole token on or to the right of the cursor and post it to the clipboard. -\ITEM \STYLE{code} \END Sets the mark to the current position of the cursor. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END Copy the text in the range from the cursor to the mark onto the clipboard. -\ITEM \STYLE{code} \END Deletes the text in the range between the cursor and the mark. -\ITEM \STYLE{code} \END Delete the line the on which the cursor sits. -\ITEM \STYLE{code} \END Centers the view vertically on the line on which the cursor sits. -\ITEM \STYLE{code} \END Sets the left size of the view near the x position of the cursor. -\ITEM \STYLE{code} \END Begins an incremental search down through the current buffer for a user specified string. -\ITEM \STYLE{code} \END Queries the user for a string and lists all exact case-sensitive matches found in all open buffers. -\ITEM \STYLE{code} \END Queries the user for a string and lists all case-insensitive substring matches found in all open buffers. -\ITEM \STYLE{code} \END Queries the user for a number, and jumps the cursor to the corresponding line. -\ITEM \STYLE{code} \END Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers. -\ITEM \STYLE{code} \END Kills the current buffer. -\ITEM \STYLE{code} \END Create a copy of the line on which the cursor sits. -\ITEM \STYLE{code} \END Swaps the position of the cursor and the mark. -\ITEM \STYLE{code} \END Reopen the current buffer from the hard drive. -\ITEM \STYLE{code} \END Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string. -\ITEM \STYLE{code} \END Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string. -\ITEM \STYLE{code} \END Begins an incremental search up through the current buffer for a user specified string. -\ITEM \STYLE{code} \END Saves the current buffer. -\ITEM \STYLE{code} \END Begins an incremental search down through the current buffer for the word or token under the cursor. -\ITEM \STYLE{code} \END Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers. -\ITEM \STYLE{code} \END Paste from the top of clipboard and run auto-indent on the newly pasted text. -\ITEM \STYLE{code} \END Paste the next item on the clipboard and run auto-indent on the newly pasted text. -\ITEM \STYLE{code} \END Cut the text in the range from the cursor to the mark onto the clipboard. -\ITEM \STYLE{code} \END Advances forewards through the undo history. -\ITEM \STYLE{code} \END Advances backwards through the undo history. -\ITEM \STYLE{code} \END Set the other non-active panel to view the buffer that the active panel views, and switch to that panel. -\ITEM \STYLE{code} \END Set the other non-active panel to view the buffer that the active panel views, and switch to that panel. -\ITEM \STYLE{code} \END If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor. -\ITEM \STYLE{code} \END If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel. -\ITEM \STYLE{code} > \END When executed on a buffer with jumps, creates a persistent lister for all the jumps -\ITEM \STYLE{code} \END Inserts whatever character was used to trigger this command. -\END -\END -\SECTION{default-code-map} -The following commands only apply in files where the lexer (syntax highlighting) is turned on. -\LIST -\ITEM \STYLE{code} \END Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters. -\ITEM \STYLE{code} \END Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters. -\ITEM \STYLE{code} \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <}> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <)> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <]> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <;> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} <#> \END Inserts a character and auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} \END Turns uncommented lines into commented lines and vice versa for comments starting with '//'. -\ITEM \STYLE{code} \END Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string. -\ITEM \STYLE{code} \END Auto-indents the range between the cursor and the mark. -\ITEM \STYLE{code} \END Auto-indents the line on which the cursor sits. -\ITEM \STYLE{code} \END At the cursor, insert a block comment. -\ITEM \STYLE{code} \END At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder. -\ITEM \STYLE{code} \END At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder. -\ITEM \STYLE{code} \END Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string. -\ITEM \STYLE{code} \END Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it. -\ITEM \STYLE{code} \END At the cursor, insert a '{' and '}' separated by a blank line. -\ITEM \STYLE{code} \END At the cursor, insert a '{' and '};' separated by a blank line. -\ITEM \STYLE{code} \END At the cursor, insert a '{' and '}break;' separated by a blank line. -\ITEM \STYLE{code} \END Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'. -\ITEM \STYLE{code} \END Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'. -\ITEM \STYLE{code} \END Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'. -\ITEM \STYLE{code} \END Wraps the code contained in the range between cursor and mark with a new curly brace scope. -\ITEM \STYLE{code} \END Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope. -\ITEM \STYLE{code} \END 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. -\ITEM \STYLE{code} \END Surround the range between the cursor and mark with an '#if 0' and an '#endif' -\ITEM \STYLE{code} \END Reads a filename from surrounding '"' characters and attempts to open the corresponding file. -\ITEM \STYLE{code} \END If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view. -\ITEM \STYLE{code} \END At the cursor, insert a ' = {};'. -\END -\END -\SECTION{default-lister-ui-map} -These commands apply in 'lister mode' such as when you open a file. -\LIST -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's write character handler. -\ITEM \STYLE{code} \END A lister mode command that quits the list without executing any actions. -\ITEM \STYLE{code} \END A lister mode command that activates the list's action on the highlighted item. -\ITEM \STYLE{code} \END A lister mode command that activates the list's action on the highlighted item. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's backspace text field handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate up handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate up handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate down handler. -\ITEM \STYLE{code} \END A lister mode command that dispatches to the lister's navigate down handler. -\ITEM \STYLE{code} \END A lister mode command that scrolls the list in response to the mouse wheel. -\ITEM \STYLE{code} \END A lister mode command that beings a click interaction with a list item under the mouse. -\ITEM \STYLE{code} \END A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it. -\ITEM \STYLE{code} \END A lister mode command that updates the lists UI data. -\ITEM \STYLE{code} \END A lister mode command that updates the lists UI data. -\END -\END -\END