Fixed boundary crossing tab-completion issue
							parent
							
								
									8d4626f27c
								
							
						
					
					
						commit
						bc2c8601ca
					
				|  | @ -2894,25 +2894,28 @@ animate_in_n_milliseconds(Application_Links *app, u32 n) | |||
| } | ||||
| 
 | ||||
| api(custom) function String_Match_List | ||||
| buffer_find_all_matches(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction) | ||||
| { | ||||
| buffer_find_all_matches(Application_Links *app, Arena *arena, Buffer_ID buffer, | ||||
|                         i32 string_id, Range_i64 range, String_Const_u8 needle, | ||||
|                         Character_Predicate *predicate, Scan_Direction direction){ | ||||
|     Models *models = (Models*)app->cmd_context; | ||||
|     Editing_File *file = imp_get_file(models, buffer); | ||||
|     String_Match_List list = {}; | ||||
|     if (api_check_buffer(file)){ | ||||
|         if (needle.size > 0){ | ||||
|             Scratch_Block scratch(app); | ||||
|             List_String_Const_u8 chunks = buffer_get_chunks(scratch, &file->state.buffer); | ||||
|             List_String_Const_u8 chunks = buffer_get_chunks(scratch, | ||||
|                                                             &file->state.buffer); | ||||
|             buffer_chunks_clamp(&chunks, range); | ||||
|             if (chunks.node_count > 0){ | ||||
|                 u64_Array jump_table = string_compute_needle_jump_table(arena, needle, direction); | ||||
|                 u64_Array jump_table = string_compute_needle_jump_table(arena, needle, | ||||
|                                                                         direction); | ||||
|                 Character_Predicate dummy = {}; | ||||
|                 if (predicate == 0){ | ||||
|                     predicate = &dummy; | ||||
|                 } | ||||
|                 list = find_all_matches(arena, max_i32, | ||||
|                                         chunks, needle, jump_table, predicate, direction, | ||||
|                                         range.min, buffer, string_id); | ||||
|                                         chunks, needle, jump_table, predicate, | ||||
|                                         direction, range.min, buffer, string_id); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -729,7 +729,8 @@ get_pos_range_from_line_range(Application_Links *app, Buffer_ID buffer, Range_i6 | |||
| } | ||||
| 
 | ||||
| internal Range_i64 | ||||
| enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, Boundary_Function *func){ | ||||
| enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, | ||||
|                  Boundary_Function *func){ | ||||
|     i64 new_min       = func(app, buffer, Side_Min, Scan_Backward, range.min + 1); | ||||
|     i64 new_min_check = func(app, buffer, Side_Max, Scan_Backward, range.min + 1); | ||||
|     if (new_min_check <= new_min && new_min < range.min){ | ||||
|  | @ -743,6 +744,28 @@ enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, Boun | |||
|     return(range); | ||||
| } | ||||
| 
 | ||||
| internal Range_i64 | ||||
| left_enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, | ||||
|                        Boundary_Function *func){ | ||||
|     i64 new_min       = func(app, buffer, Side_Min, Scan_Backward, range.min + 1); | ||||
|     i64 new_min_check = func(app, buffer, Side_Max, Scan_Backward, range.min + 1); | ||||
|     if (new_min_check <= new_min && new_min < range.min){ | ||||
|         range.min = new_min; | ||||
|     } | ||||
|     return(range); | ||||
| } | ||||
| 
 | ||||
| internal Range_i64 | ||||
| right_enclose_boundary(Application_Links *app, Buffer_ID buffer, Range_i64 range, | ||||
|                        Boundary_Function *func){ | ||||
|     i64 new_max       = func(app, buffer, Side_Max, Scan_Forward, range.max - 1); | ||||
|     i64 new_max_check = func(app, buffer, Side_Min, Scan_Forward, range.max - 1); | ||||
|     if (new_max_check >= new_max && new_max > range.max){ | ||||
|         range.max = new_max; | ||||
|     } | ||||
|     return(range); | ||||
| } | ||||
| 
 | ||||
| internal Range_i64 | ||||
| enclose_non_whitespace(Application_Links *app, Buffer_ID buffer, Range_i64 range){ | ||||
|     return(enclose_boundary(app, buffer, range, boundary_non_whitespace)); | ||||
|  | @ -814,6 +837,11 @@ internal Range_i64 | |||
| enclose_pos_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, i64 pos){ | ||||
|     return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_underscore)); | ||||
| } | ||||
| internal Range_i64 | ||||
| right_enclose_alpha_numeric_underscore(Application_Links *app, Buffer_ID buffer, | ||||
|                                        Range_i64 range){ | ||||
|     return(right_enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore)); | ||||
| } | ||||
| 
 | ||||
| internal Range_i64 | ||||
| enclose_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, Range_i64 range){ | ||||
|  | @ -823,6 +851,12 @@ internal Range_i64 | |||
| enclose_pos_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, i64 pos){ | ||||
|     return(enclose_boundary(app, buffer, Ii64(pos), boundary_alpha_numeric_underscore_utf8)); | ||||
| } | ||||
| internal Range_i64 | ||||
| right_enclose_alpha_numeric_underscore_utf8(Application_Links *app, Buffer_ID buffer, | ||||
|                                             Range_i64 range){ | ||||
|     return(right_enclose_boundary(app, buffer, range, boundary_alpha_numeric_underscore_utf8)); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| internal Range_i64 | ||||
| enclose_alpha_numeric_camel(Application_Links *app, Buffer_ID buffer, Range_i64 range){ | ||||
|  |  | |||
|  | @ -241,7 +241,8 @@ get_word_complete_needle_range(Application_Links *app, Buffer_ID buffer, i64 pos | |||
| } | ||||
| 
 | ||||
| internal void | ||||
| string_match_list_enclose_all(Application_Links *app, String_Match_List list, Enclose_Function *enclose){ | ||||
| string_match_list_enclose_all(Application_Links *app, String_Match_List list, | ||||
|                               Enclose_Function *enclose){ | ||||
|     for (String_Match *node = list.first; | ||||
|          node != 0; | ||||
|          node = node->next){ | ||||
|  | @ -320,7 +321,8 @@ get_word_complete_match_list__unreduced(Application_Links *app, Arena *arena, Bu | |||
|     string_match_list_filter_remove_buffer(&everywhere, buffer); | ||||
|      | ||||
|     String_Match_List whole_list = string_match_list_join(&here, &everywhere); | ||||
|     string_match_list_enclose_all(app, whole_list, enclose_alpha_numeric_underscore_utf8); | ||||
|     string_match_list_enclose_all(app, whole_list, | ||||
|                                   right_enclose_alpha_numeric_underscore_utf8); | ||||
|      | ||||
|     return(whole_list); | ||||
| } | ||||
|  | @ -328,7 +330,8 @@ get_word_complete_match_list__unreduced(Application_Links *app, Arena *arena, Bu | |||
| internal String_Match_List | ||||
| get_word_complete_match_list__unreduced(Application_Links *app, Arena *arena, String_Const_u8 needle){ | ||||
|     String_Match_List whole_list = find_all_matches_all_buffers(app, arena, needle, word_complete_must, word_complete_must_not); | ||||
|     string_match_list_enclose_all(app, whole_list, enclose_alpha_numeric_underscore_utf8); | ||||
|     string_match_list_enclose_all(app, whole_list, | ||||
|                                   right_enclose_alpha_numeric_underscore_utf8); | ||||
|     return(whole_list); | ||||
| } | ||||
| 
 | ||||
|  | @ -347,7 +350,8 @@ get_word_complete_match_list(Application_Links *app, Arena *arena, String_Const_ | |||
| } | ||||
| 
 | ||||
| internal Word_Complete_State | ||||
| get_word_complete_state(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 needle_range){ | ||||
| get_word_complete_state(Application_Links *app, Arena *arena, Buffer_ID buffer, | ||||
|                         Range_i64 needle_range){ | ||||
|     String_Const_u8 needle = push_buffer_range(app, arena, buffer, needle_range); | ||||
|      | ||||
|     Scratch_Block scratch(app); | ||||
|  |  | |||
|  | @ -229,12 +229,12 @@ i32 line_number; | |||
| }; | ||||
| static Command_Metadata fcoder_metacmd_table[207] = { | ||||
| { PROC_LINKS(default_view_input_handler, 0), "default_view_input_handler", 26,  "Input consumption loop for default view behavior", 48, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 56 }, | ||||
| { PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30,  "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2061 }, | ||||
| { PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24,  "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2067 }, | ||||
| { PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22,  "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2073 }, | ||||
| { PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16,  "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2079 }, | ||||
| { 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\\custom\\4coder_helper.cpp", 36, 2085 }, | ||||
| { 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\\custom\\4coder_helper.cpp", 36, 2093 }, | ||||
| { PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30,  "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2095 }, | ||||
| { PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24,  "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2101 }, | ||||
| { PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22,  "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2107 }, | ||||
| { PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16,  "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2113 }, | ||||
| { 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\\custom\\4coder_helper.cpp", 36, 2119 }, | ||||
| { 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\\custom\\4coder_helper.cpp", 36, 2127 }, | ||||
| { 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\\custom\\4coder_default_framework.cpp", 47, 203 }, | ||||
| { 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\\custom\\4coder_default_framework.cpp", 47, 213 }, | ||||
| { PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17,  "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 223 }, | ||||
|  | @ -368,7 +368,7 @@ static Command_Metadata fcoder_metacmd_table[207] = { | |||
| { 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\\custom\\4coder_search.cpp", 36, 208 }, | ||||
| { 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\\custom\\4coder_search.cpp", 36, 214 }, | ||||
| { 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\\custom\\4coder_search.cpp", 36, 222 }, | ||||
| { 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\\custom\\4coder_search.cpp", 36, 378 }, | ||||
| { 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\\custom\\4coder_search.cpp", 36, 382 }, | ||||
| { PROC_LINKS(goto_jump_at_cursor, 0), "goto_jump_at_cursor", 19,  "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\\custom\\4coder_jump_sticky.cpp", 41, 346 }, | ||||
| { PROC_LINKS(goto_jump_at_cursor_same_panel, 0), "goto_jump_at_cursor_same_panel", 30,  "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\\custom\\4coder_jump_sticky.cpp", 41, 373 }, | ||||
| { PROC_LINKS(goto_next_jump, 0), "goto_next_jump", 14,  "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\\custom\\4coder_jump_sticky.cpp", 41, 462 }, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue