more fine tuned control over autocomplete in new
This commit is contained in:
parent
33407c2258
commit
7dee6e880c
|
@ -3349,14 +3349,13 @@ struct Single_Line_Mode{
|
||||||
Single_Line_Input_Type type;
|
Single_Line_Input_Type type;
|
||||||
String *string;
|
String *string;
|
||||||
Hot_Directory *hot_directory;
|
Hot_Directory *hot_directory;
|
||||||
b32 fast_folder_select;
|
|
||||||
b32 try_to_match;
|
b32 try_to_match;
|
||||||
b32 case_sensitive;
|
b32 case_sensitive;
|
||||||
};
|
};
|
||||||
|
|
||||||
internal Single_Line_Input_Step
|
internal Single_Line_Input_Step
|
||||||
app_single_line_input_core(System_Functions *system, Working_Set *working_set,
|
app_single_line_input_core(System_Functions *system, Working_Set *working_set,
|
||||||
Key_Event_Data key, Single_Line_Mode mode){
|
Key_Event_Data key, Single_Line_Mode mode){
|
||||||
Single_Line_Input_Step result = {0};
|
Single_Line_Input_Step result = {0};
|
||||||
|
|
||||||
if (key.keycode == key_back){
|
if (key.keycode == key_back){
|
||||||
|
@ -3372,11 +3371,16 @@ app_single_line_input_core(System_Functions *system, Working_Set *working_set,
|
||||||
|
|
||||||
case SINGLE_LINE_FILE:
|
case SINGLE_LINE_FILE:
|
||||||
{
|
{
|
||||||
char end_character = mode.string->str[mode.string->size];
|
if (!key.modifiers[MDFR_CONTROL_INDEX]){
|
||||||
if (char_is_slash(end_character)){
|
char end_character = mode.string->str[mode.string->size];
|
||||||
mode.string->size = reverse_seek_slash(*mode.string) + 1;
|
if (char_is_slash(end_character)){
|
||||||
mode.string->str[mode.string->size] = 0;
|
mode.string->size = reverse_seek_slash(*mode.string) + 1;
|
||||||
hot_directory_set(system, mode.hot_directory, *mode.string, working_set);
|
mode.string->str[mode.string->size] = 0;
|
||||||
|
hot_directory_set(system, mode.hot_directory, *mode.string, working_set);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mode.string->str[mode.string->size] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
mode.string->str[mode.string->size] = 0;
|
mode.string->str[mode.string->size] = 0;
|
||||||
|
@ -3397,8 +3401,7 @@ app_single_line_input_core(System_Functions *system, Working_Set *working_set,
|
||||||
|
|
||||||
else if (key.character){
|
else if (key.character){
|
||||||
result.hit_a_character = 1;
|
result.hit_a_character = 1;
|
||||||
if (!key.modifiers[MDFR_CONTROL_INDEX] &&
|
if (!key.modifiers[MDFR_CONTROL_INDEX] && !key.modifiers[MDFR_ALT_INDEX]){
|
||||||
!key.modifiers[MDFR_ALT_INDEX]){
|
|
||||||
if (mode.string->size+1 < mode.string->memory_size){
|
if (mode.string->size+1 < mode.string->memory_size){
|
||||||
u8 new_character = (u8)key.character;
|
u8 new_character = (u8)key.character;
|
||||||
mode.string->str[mode.string->size] = new_character;
|
mode.string->str[mode.string->size] = new_character;
|
||||||
|
@ -3430,12 +3433,11 @@ inline Single_Line_Input_Step
|
||||||
app_single_file_input_step(System_Functions *system,
|
app_single_file_input_step(System_Functions *system,
|
||||||
Working_Set *working_set, Key_Event_Data key,
|
Working_Set *working_set, Key_Event_Data key,
|
||||||
String *string, Hot_Directory *hot_directory,
|
String *string, Hot_Directory *hot_directory,
|
||||||
b32 fast_folder_select, b32 try_to_match, b32 case_sensitive){
|
b32 try_to_match, b32 case_sensitive){
|
||||||
Single_Line_Mode mode = {};
|
Single_Line_Mode mode = {};
|
||||||
mode.type = SINGLE_LINE_FILE;
|
mode.type = SINGLE_LINE_FILE;
|
||||||
mode.string = string;
|
mode.string = string;
|
||||||
mode.hot_directory = hot_directory;
|
mode.hot_directory = hot_directory;
|
||||||
mode.fast_folder_select = fast_folder_select;
|
|
||||||
mode.try_to_match = try_to_match;
|
mode.try_to_match = try_to_match;
|
||||||
mode.case_sensitive = case_sensitive;
|
mode.case_sensitive = case_sensitive;
|
||||||
return app_single_line_input_core(system, working_set, key, mode);
|
return app_single_line_input_core(system, working_set, key, mode);
|
||||||
|
@ -3919,11 +3921,11 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
||||||
switch (view->interaction){
|
switch (view->interaction){
|
||||||
case IInt_Sys_File_List:
|
case IInt_Sys_File_List:
|
||||||
{
|
{
|
||||||
b32 use_item_in_list = 1;
|
b32 autocomplete_with_enter = 1;
|
||||||
b32 activate_directly = 0;
|
b32 activate_directly = 0;
|
||||||
|
|
||||||
if (view->action == IAct_Save_As || view->action == IAct_New){
|
if (view->action == IAct_Save_As || view->action == IAct_New){
|
||||||
use_item_in_list = 0;
|
autocomplete_with_enter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
String message = {0};
|
String message = {0};
|
||||||
|
@ -3949,12 +3951,12 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
||||||
for (i = 0; i < keys.count; ++i){
|
for (i = 0; i < keys.count; ++i){
|
||||||
key = get_single_key(&keys, i);
|
key = get_single_key(&keys, i);
|
||||||
step = app_single_file_input_step(system, &models->working_set, key,
|
step = app_single_file_input_step(system, &models->working_set, key,
|
||||||
&hdir->string, hdir, 1, 1, 0);
|
&hdir->string, hdir, 1, 0);
|
||||||
if (step.made_a_change){
|
if (step.made_a_change){
|
||||||
view->list_i = 0;
|
view->list_i = 0;
|
||||||
result.consume_keys = 1;
|
result.consume_keys = 1;
|
||||||
}
|
}
|
||||||
if (!use_item_in_list && (key.keycode == '\n' || key.keycode == '\t')){
|
if (!autocomplete_with_enter && key.keycode == '\n'){
|
||||||
activate_directly = 1;
|
activate_directly = 1;
|
||||||
result.consume_keys = 1;
|
result.consume_keys = 1;
|
||||||
}
|
}
|
||||||
|
@ -3998,7 +4000,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
||||||
set_last_folder_sc(&hdir->string, file_info.info->filename, '/');
|
set_last_folder_sc(&hdir->string, file_info.info->filename, '/');
|
||||||
do_new_directory = 1;
|
do_new_directory = 1;
|
||||||
}
|
}
|
||||||
else if (use_item_in_list){
|
else if (autocomplete_with_enter){
|
||||||
complete = 1;
|
complete = 1;
|
||||||
copy_ss(&comp_dest, loop.full_path);
|
copy_ss(&comp_dest, loop.full_path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1257,7 +1257,7 @@ gui_do_jump(GUI_Target *target, GUI_View_Jump jump, GUI_Scroll_Vars vars){
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
gui_standard_list(GUI_Target *target, GUI_id id, GUI_Scroll_Vars *vars, i32_Rect scroll_region,
|
gui_standard_list(GUI_Target *target, GUI_id id, GUI_Scroll_Vars *vars, i32_Rect scroll_region,
|
||||||
Key_Summary *keys, i32 *list_i, GUI_Item_Update *update){
|
Key_Summary *keys, i32 *list_i, GUI_Item_Update *update){
|
||||||
|
|
||||||
if (update->has_adjustment){
|
if (update->has_adjustment){
|
||||||
*list_i = update->adjustment_value;
|
*list_i = update->adjustment_value;
|
||||||
|
|
Loading…
Reference in New Issue