Backspace in file search deletes whole word

This commit is contained in:
PS 2024-02-10 15:54:29 -08:00
parent 8552305ecc
commit ba8c8a1c6d
2 changed files with 8 additions and 13 deletions

View File

@ -274,12 +274,7 @@ lister__backspace_text_field__file_path(Application_Links *app){
User_Input input = get_current_input(app); User_Input input = get_current_input(app);
String_Const_u8 text_field = lister->text_field.string; String_Const_u8 text_field = lister->text_field.string;
String_Const_u8 new_hot = string_remove_last_folder(text_field); String_Const_u8 new_hot = string_remove_last_folder(text_field);
b32 is_modified = has_modifier(&input, KeyCode_Control); lister->text_field.size = new_hot.size;
b32 whole_word_when_mod = def_get_config_b32(vars_save_string_lit("lister_whole_word_backspace_when_modified"));
b32 whole_word_backspace = (is_modified == whole_word_when_mod);
if (whole_word_backspace){
lister->text_field.size = new_hot.size;
}
set_hot_directory(app, new_hot); set_hot_directory(app, new_hot);
// TODO(allen): We have to protect against lister_call_refresh_handler // TODO(allen): We have to protect against lister_call_refresh_handler
// changing the text_field here. Clean this up. // changing the text_field here. Clean this up.

View File

@ -320,7 +320,7 @@ static Command_Metadata fcoder_metacmd_table[269] = {
{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\projects\\4coder_gs\\code\\custom\\4coder_build_commands.cpp", 59, 175 }, { PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\projects\\4coder_gs\\code\\custom\\4coder_build_commands.cpp", 59, 175 },
{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 809 }, { PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 809 },
{ PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "C:\\projects\\4coder_gs\\code\\custom\\4coder_docs.cpp", 49, 190 }, { PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "C:\\projects\\4coder_gs\\code\\custom\\4coder_docs.cpp", 49, 190 },
{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 761 }, { PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 756 },
{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "C:\\projects\\4coder_gs\\code\\custom\\4coder_combined_write_commands.cpp", 68, 125 }, { PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "C:\\projects\\4coder_gs\\code\\custom\\4coder_combined_write_commands.cpp", 68, 125 },
{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "C:\\projects\\4coder_gs\\code\\custom\\4coder_combined_write_commands.cpp", 68, 149 }, { PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "C:\\projects\\4coder_gs\\code\\custom\\4coder_combined_write_commands.cpp", 68, 149 },
{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\projects\\4coder_gs\\code\\custom\\4coder_clipboard.cpp", 54, 110 }, { PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\projects\\4coder_gs\\code\\custom\\4coder_clipboard.cpp", 54, 110 },
@ -365,11 +365,11 @@ static Command_Metadata fcoder_metacmd_table[269] = {
{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "C:\\projects\\4coder_gs\\code\\custom\\4coder_jump_sticky.cpp", 56, 564 }, { PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "C:\\projects\\4coder_gs\\code\\custom\\4coder_jump_sticky.cpp", 56, 564 },
{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\projects\\4coder_gs\\code\\custom\\4coder_jump_sticky.cpp", 56, 581 }, { PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\projects\\4coder_gs\\code\\custom\\4coder_jump_sticky.cpp", 56, 581 },
{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 881 }, { PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 881 },
{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 521 }, { PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 516 },
{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 661 }, { PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 656 },
{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 715 }, { PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 710 },
{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 612 }, { PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 607 },
{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 511 }, { PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 506 },
{ PROC_LINKS(jump_to_definition, 0), true, "jump_to_definition", 18, "List all definitions in the code index and jump to one chosen by the user.", 74, "C:\\projects\\4coder_gs\\code\\custom\\4coder_code_index_listers.cpp", 63, 12 }, { PROC_LINKS(jump_to_definition, 0), true, "jump_to_definition", 18, "List all definitions in the code index and jump to one chosen by the user.", 74, "C:\\projects\\4coder_gs\\code\\custom\\4coder_code_index_listers.cpp", 63, 12 },
{ PROC_LINKS(jump_to_definition_at_cursor, 0), true, "jump_to_definition_at_cursor", 28, "Jump to the first definition in the code index matching an identifier at the cursor", 83, "C:\\projects\\4coder_gs\\code\\custom\\4coder_code_index_listers.cpp", 63, 68 }, { PROC_LINKS(jump_to_definition_at_cursor, 0), true, "jump_to_definition_at_cursor", 28, "Jump to the first definition in the code index matching an identifier at the cursor", 83, "C:\\projects\\4coder_gs\\code\\custom\\4coder_code_index_listers.cpp", 63, 68 },
{ PROC_LINKS(jump_to_last_point, 0), false, "jump_to_last_point", 18, "Read from the top of the point stack and jump there; if already there pop the top and go to the next option", 107, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 1471 }, { PROC_LINKS(jump_to_last_point, 0), false, "jump_to_last_point", 18, "Read from the top of the point stack and jump there; if already there pop the top and go to the next option", 107, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 1471 },
@ -528,7 +528,7 @@ static Command_Metadata fcoder_metacmd_table[269] = {
{ PROC_LINKS(string_repeat, 0), false, "string_repeat", 13, "Example of query_user_string and query_user_number", 50, "C:\\projects\\4coder_gs\\code\\custom\\4coder_examples.cpp", 53, 179 }, { PROC_LINKS(string_repeat, 0), false, "string_repeat", 13, "Example of query_user_string and query_user_number", 50, "C:\\projects\\4coder_gs\\code\\custom\\4coder_examples.cpp", 53, 179 },
{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\projects\\4coder_gs\\code\\custom\\4coder_default_framework.cpp", 62, 475 }, { PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\projects\\4coder_gs\\code\\custom\\4coder_default_framework.cpp", 62, 475 },
{ PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 1844 }, { PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 1844 },
{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 785 }, { PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "C:\\projects\\4coder_gs\\code\\custom\\4coder_lists.cpp", 50, 780 },
{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 702 }, { PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 702 },
{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 689 }, { PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 689 },
{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 846 }, { PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "C:\\projects\\4coder_gs\\code\\custom\\4coder_base_commands.cpp", 58, 846 },