diff --git a/custom/4coder_auto_indent.cpp b/custom/4coder_auto_indent.cpp index f6460cd0..578a7120 100644 --- a/custom/4coder_auto_indent.cpp +++ b/custom/4coder_auto_indent.cpp @@ -268,10 +268,10 @@ get_indentation_array(Application_Links *app, Arena *arena, Buffer_ID buffer, Ra //ignore_unfinished_statement = true; }break; } - } - - if (in_unfinished_statement && !ignore_unfinished_statement){ - this_indent += indent_width; + + if (in_unfinished_statement && !ignore_unfinished_statement){ + this_indent += indent_width; + } } #define EMIT(N) \ diff --git a/custom/4coder_base_types.cpp b/custom/4coder_base_types.cpp index 6585e4e7..11cd0065 100644 --- a/custom/4coder_base_types.cpp +++ b/custom/4coder_base_types.cpp @@ -4759,7 +4759,7 @@ string_find_first(String_Const_char str, String_Const_char needle, String_Match_ if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; char c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -4783,7 +4783,7 @@ string_find_first(String_Const_u8 str, String_Const_u8 needle, String_Match_Rule if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; u8 c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -4807,7 +4807,7 @@ string_find_first(String_Const_u16 str, String_Const_u16 needle, String_Match_Ru if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; u16 c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -4831,7 +4831,7 @@ string_find_first(String_Const_u32 str, String_Const_u32 needle, String_Match_Ru if (needle.size > 0){ i = str.size; if (str.size >= needle.size){ - i = 0; + i = 0; u32 c = character_to_upper(needle.str[0]); u64 one_past_last = str.size - needle.size + 1; for (;i < one_past_last; i += 1){ @@ -7043,7 +7043,7 @@ string_from_integer(Arena *arena, u64 x, u32 radix){ function b32 string_is_integer(String_Const_u8 string, u32 radix){ b32 is_integer = false; - if (radix <= 16){ + if (string.size > 0 && radix <= 16){ is_integer = true; for (u64 i = 0; i < string.size; i += 1){ if (string.str[i] < 128){ diff --git a/custom/4coder_combined_write_commands.cpp b/custom/4coder_combined_write_commands.cpp index b86117af..a9a03747 100644 --- a/custom/4coder_combined_write_commands.cpp +++ b/custom/4coder_combined_write_commands.cpp @@ -94,7 +94,7 @@ CUSTOM_DOC("At the cursor, insert a '// NOTE' comment, includes user name if it CUSTOM_COMMAND_SIG(write_block) CUSTOM_DOC("At the cursor, insert a block comment.") { - write_string(app, string_u8_litexpr("/* */")); + place_begin_and_end_on_own_lines(app, "/* ", " */"); } CUSTOM_COMMAND_SIG(write_zero_struct) diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 2444afe1..607cc33b 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -944,17 +944,20 @@ BUFFER_HOOK_SIG(default_new_file){ u8 c[2] = {}; u64 c_size = 1; u8 ch = file_name.str[i]; - if (ch == '.'){ - c[0] = '_'; - } - else if (ch >= 'A' && ch <= 'Z'){ + if ('A' <= ch && ch <= 'Z'){ c_size = 2; c[0] = '_'; c[1] = ch; } - else if (ch >= 'a' && ch <= 'z'){ + else if ('0' <= ch && ch <= '9'){ + c[0] = ch; + } + else if ('a' <= ch && ch <= 'z'){ c[0] = ch - ('a' - 'A'); } + else{ + c[0] = '_'; + } String_Const_u8 part = push_string_copy(scratch, SCu8(c, c_size)); string_list_push(scratch, &guard_list, part); } diff --git a/custom/4coder_default_map.cpp b/custom/4coder_default_map.cpp index 1717a299..c9aa2078 100644 --- a/custom/4coder_default_map.cpp +++ b/custom/4coder_default_map.cpp @@ -35,7 +35,7 @@ setup_default_mapping(Mapping *mapping, i64 global_id, i64 file_id, i64 code_id) Bind(execute_previous_cli, KeyCode_Z, KeyCode_Alt, KeyCode_Shift); Bind(command_lister, KeyCode_X, KeyCode_Alt); Bind(project_command_lister, KeyCode_X, KeyCode_Alt, KeyCode_Shift); - Bind(list_all_functions_current_buffer, KeyCode_I, KeyCode_Control, KeyCode_Shift); + Bind(list_all_functions_current_buffer_lister, KeyCode_I, KeyCode_Control, KeyCode_Shift); Bind(project_fkey_command, KeyCode_F1); Bind(project_fkey_command, KeyCode_F2); Bind(project_fkey_command, KeyCode_F3); diff --git a/custom/4coder_function_list.cpp b/custom/4coder_function_list.cpp index 80ac51d8..a14a2358 100644 --- a/custom/4coder_function_list.cpp +++ b/custom/4coder_function_list.cpp @@ -274,7 +274,7 @@ CUSTOM_DOC("Creates a jump list of lines of the current buffer that appear to de } } -CUSTOM_COMMAND_SIG(list_all_functions_current_buffer_lister) +CUSTOM_UI_COMMAND_SIG(list_all_functions_current_buffer_lister) CUSTOM_DOC("Creates a lister of locations that look like function definitions and declarations in the buffer.") { Heap *heap = &global_heap; @@ -286,8 +286,7 @@ CUSTOM_DOC("Creates a lister of locations that look like function definitions an buffer = view_get_buffer(app, view, Access_Always); Marker_List *list = get_or_make_list_for_buffer(app, heap, buffer); if (list != 0){ - Jump_Lister_Result jump = get_jump_index_from_user(app, list, - "Function:"); + Jump_Lister_Result jump = get_jump_index_from_user(app, list, "Function:"); jump_to_jump_lister_result(app, view, list, &jump); } } @@ -299,7 +298,7 @@ CUSTOM_DOC("Creates a jump list of lines from all buffers that appear to define list_all_functions(app, 0); } -CUSTOM_COMMAND_SIG(list_all_functions_all_buffers_lister) +CUSTOM_UI_COMMAND_SIG(list_all_functions_all_buffers_lister) CUSTOM_DOC("Creates a lister of locations that look like function definitions and declarations all buffers.") { Heap *heap = &global_heap; diff --git a/custom/generated/command_metadata.h b/custom/generated/command_metadata.h index 24c2dfd0..9c6edbd9 100644 --- a/custom/generated/command_metadata.h +++ b/custom/generated/command_metadata.h @@ -328,10 +328,10 @@ static Command_Metadata fcoder_metacmd_table[231] = { { PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1577 }, { PROC_LINKS(kill_tutorial, 0), false, "kill_tutorial", 13, "If there is an active tutorial, kill it.", 40, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 9 }, { PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 222 }, -{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 296 }, -{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 302 }, +{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 295 }, +{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), true, "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\\custom\\4coder_function_list.cpp", 43, 301 }, { PROC_LINKS(list_all_functions_current_buffer, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 267 }, -{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "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\\custom\\4coder_function_list.cpp", 43, 277 }, +{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), true, "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\\custom\\4coder_function_list.cpp", 43, 277 }, { PROC_LINKS(list_all_locations, 0), false, "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\\custom\\4coder_search.cpp", 36, 165 }, { PROC_LINKS(list_all_locations_case_insensitive, 0), false, "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\\custom\\4coder_search.cpp", 36, 177 }, { PROC_LINKS(list_all_locations_of_identifier, 0), false, "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\\custom\\4coder_search.cpp", 36, 189 }, diff --git a/ship_files/changes.txt b/ship_files/changes.txt index e8c636ab..9f20efcb 100644 --- a/ship_files/changes.txt +++ b/ship_files/changes.txt @@ -3,6 +3,7 @@ + Unkillable buffer setting + UI elements in listers and buttons can have different highlight backgrounds + command 'load_theme_current_buffer' for loading the current file as a theme and setting it as the theme + + command 'write_block' for writing a block comment uses mark and cursor range to insert block comment ends + Fix: search and replace never exits early + Fix: optimized builds of the custom layer display the dirty * on the file bar correclty + Fix: can merge "backwards" strings in the history correctly @@ -15,6 +16,10 @@ + Fix: in virtual whitespace layouts blank lines correctly mark carriage return characters before newline characters + Fix: auto-indentation leaves the carriage return in CRLF line endings in place and does not count them as indentation + Fix: lexer emit pointer advances correctly when the output buffer becomes full + + Fix: when include gaurds are inserted into new header files, the generated name isn't killed by numbers or underscores + + Fix: base library function string_is_integer returns false on empty string + + Fix: preprocessor directives after incomplete statements are aligned to zero by auto-indent + + Fix: command 'list_all_functions_current_buffer_lister' and command 'list_all_functions_all_buffers_lister' are marked as UI commands and thus do not infinite loop when they set the buffer + Improvement: optimization in clean_all_lines command, handles CRLF line endings 4.1.2