Open files from a file lister's current directory not from the hot directory
parent
a1cfefbf86
commit
a0f398ca6c
|
@ -271,7 +271,7 @@ static Command_Metadata fcoder_metacmd_table[229] = {
|
||||||
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 },
|
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 },
|
||||||
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 },
|
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 },
|
||||||
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 484 },
|
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 484 },
|
||||||
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 972 },
|
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 981 },
|
||||||
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 },
|
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 },
|
||||||
{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 96 },
|
{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 96 },
|
||||||
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 35 },
|
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 35 },
|
||||||
|
@ -313,9 +313,9 @@ static Command_Metadata fcoder_metacmd_table[229] = {
|
||||||
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 562 },
|
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 562 },
|
||||||
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 540 },
|
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 540 },
|
||||||
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 784 },
|
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 784 },
|
||||||
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 889 },
|
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 894 },
|
||||||
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 917 },
|
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 926 },
|
||||||
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 855 },
|
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 28, 856 },
|
||||||
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 765 },
|
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 765 },
|
||||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1557 },
|
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1557 },
|
||||||
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 },
|
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 },
|
||||||
|
@ -377,7 +377,7 @@ static Command_Metadata fcoder_metacmd_table[229] = {
|
||||||
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 573 },
|
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 573 },
|
||||||
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 },
|
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 },
|
||||||
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 },
|
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 },
|
||||||
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 933 },
|
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 942 },
|
||||||
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1464 },
|
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1464 },
|
||||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1619 },
|
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1619 },
|
||||||
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 57 },
|
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 57 },
|
||||||
|
|
|
@ -790,8 +790,8 @@ CUSTOM_DOC("Interactively kill an open buffer.")
|
||||||
}
|
}
|
||||||
|
|
||||||
static Lister_Activation_Code
|
static Lister_Activation_Code
|
||||||
activate_open_or_new__generic(Application_Links *app, View_Summary *view,
|
activate_open_or_new__generic(Application_Links *app, Partition *scratch, View_Summary *view,
|
||||||
String file_name, bool32 is_folder,
|
String path, String file_name, bool32 is_folder,
|
||||||
Buffer_Create_Flag flags){
|
Buffer_Create_Flag flags){
|
||||||
Lister_Activation_Code result = 0;
|
Lister_Activation_Code result = 0;
|
||||||
|
|
||||||
|
@ -801,16 +801,13 @@ activate_open_or_new__generic(Application_Links *app, View_Summary *view,
|
||||||
result = ListerActivation_Finished;
|
result = ListerActivation_Finished;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Partition *scratch = &global_part;
|
|
||||||
Temp_Memory temp = begin_temp_memory(scratch);
|
Temp_Memory temp = begin_temp_memory(scratch);
|
||||||
String full_file_name = get_hot_directory(app, scratch);
|
String full_file_name = {};
|
||||||
if (full_file_name.size == 0 ||
|
if (path.size == 0 || !char_is_slash(path.str[path.size - 1])){
|
||||||
(full_file_name.str[full_file_name.size - 1] != '/' &&
|
full_file_name = build_string(scratch, path, "/", file_name);
|
||||||
full_file_name.str[full_file_name.size - 1] != '\\')){
|
|
||||||
full_file_name = build_string(scratch, full_file_name, "/", file_name);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
full_file_name = build_string(scratch, full_file_name, "", file_name);
|
full_file_name = build_string(scratch, path, "", file_name);
|
||||||
}
|
}
|
||||||
if (is_folder){
|
if (is_folder){
|
||||||
directory_set_hot(app, full_file_name.str, full_file_name.size);
|
directory_set_hot(app, full_file_name.str, full_file_name.size);
|
||||||
|
@ -845,9 +842,13 @@ activate_open_or_new(Application_Links *app, Partition *scratch, Heap *heap,
|
||||||
result = ListerActivation_Finished;
|
result = ListerActivation_Finished;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
String path = state->lister.data.text_field;
|
||||||
|
if (path.size > 0 && !char_is_slash(path.str[path.size - 1])){
|
||||||
|
path = path_of_directory(path);
|
||||||
|
}
|
||||||
bool32 is_folder = (file_name.str[file_name.size - 1] == '/' && user_data != 0);
|
bool32 is_folder = (file_name.str[file_name.size - 1] == '/' && user_data != 0);
|
||||||
Buffer_Create_Flag flags = 0;
|
Buffer_Create_Flag flags = 0;
|
||||||
result = activate_open_or_new__generic(app, view, file_name, is_folder, flags);
|
result = activate_open_or_new__generic(app, scratch, view, path, file_name, is_folder, flags);
|
||||||
}
|
}
|
||||||
lister_default(app, scratch, heap, view, state, result);
|
lister_default(app, scratch, heap, view, state, result);
|
||||||
}
|
}
|
||||||
|
@ -879,9 +880,13 @@ activate_new(Application_Links *app, Partition *scratch, Heap *heap,
|
||||||
result = ListerActivation_Finished;
|
result = ListerActivation_Finished;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
String path = state->lister.data.text_field;
|
||||||
|
if (path.size > 0 && !char_is_slash(path.str[path.size - 1])){
|
||||||
|
path = path_of_directory(path);
|
||||||
|
}
|
||||||
bool32 is_folder = (file_name.str[file_name.size - 1] == '/' && user_data != 0);
|
bool32 is_folder = (file_name.str[file_name.size - 1] == '/' && user_data != 0);
|
||||||
Buffer_Create_Flag flags = BufferCreate_AlwaysNew;
|
Buffer_Create_Flag flags = BufferCreate_AlwaysNew;
|
||||||
result = activate_open_or_new__generic(app, view, file_name, is_folder, flags);
|
result = activate_open_or_new__generic(app, scratch, view, path, file_name, is_folder, flags);
|
||||||
}
|
}
|
||||||
lister_default(app, scratch, heap, view, state, result);
|
lister_default(app, scratch, heap, view, state, result);
|
||||||
}
|
}
|
||||||
|
@ -907,9 +912,13 @@ activate_open(Application_Links *app, Partition *scratch, Heap *heap,
|
||||||
result = ListerActivation_Finished;
|
result = ListerActivation_Finished;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
String path = state->lister.data.text_field;
|
||||||
|
if (path.size > 0 && !char_is_slash(path.str[path.size - 1])){
|
||||||
|
path = path_of_directory(path);
|
||||||
|
}
|
||||||
bool32 is_folder = (file_name.str[file_name.size - 1] == '/' && user_data != 0);
|
bool32 is_folder = (file_name.str[file_name.size - 1] == '/' && user_data != 0);
|
||||||
Buffer_Create_Flag flags = BufferCreate_NeverNew;
|
Buffer_Create_Flag flags = BufferCreate_NeverNew;
|
||||||
result = activate_open_or_new__generic(app, view, file_name, is_folder, flags);
|
result = activate_open_or_new__generic(app, scratch, view, path, file_name, is_folder, flags);
|
||||||
}
|
}
|
||||||
lister_default(app, scratch, heap, view, state, result);
|
lister_default(app, scratch, heap, view, state, result);
|
||||||
}
|
}
|
||||||
|
|
9
todo.txt
9
todo.txt
|
@ -33,7 +33,7 @@
|
||||||
[] Can we prevent creation of Buffer_Render_Items that are off the top?
|
[] Can we prevent creation of Buffer_Render_Items that are off the top?
|
||||||
}
|
}
|
||||||
[x] scope coloring when scrolled to the right problem
|
[x] scope coloring when scrolled to the right problem
|
||||||
[] Open file when lister hot directory doesn't match lister current directory
|
[x] Open file when lister hot directory doesn't match lister current directory
|
||||||
[] Mac german keyboard layout
|
[] Mac german keyboard layout
|
||||||
[] Linux animate bug? (Lister lag)
|
[] Linux animate bug? (Lister lag)
|
||||||
[] SSHFS segfault on linux
|
[] SSHFS segfault on linux
|
||||||
|
@ -42,11 +42,6 @@
|
||||||
{
|
{
|
||||||
[?] pasting long comment at top of code files doesn't always parse right away???
|
[?] pasting long comment at top of code files doesn't always parse right away???
|
||||||
}
|
}
|
||||||
Followup Needed
|
|
||||||
{
|
|
||||||
[] saving to removable media -> need more info
|
|
||||||
[] crash on obj file (san-miguel-low-poly.obj) -> need more info
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +69,8 @@ Long Term
|
||||||
[] Graphics problem (fonts not rendering) -> need more info
|
[] Graphics problem (fonts not rendering) -> need more info
|
||||||
[] Jim's file is blank even though it tries to load a real file (wtf)
|
[] Jim's file is blank even though it tries to load a real file (wtf)
|
||||||
[] Texture binding changes too often problem
|
[] Texture binding changes too often problem
|
||||||
|
[] saving to removable media -> need more info
|
||||||
|
[] crash on obj file (san-miguel-low-poly.obj) -> need more info
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue