Fix drive letter problem; add unkillable setting
parent
3e729e5d37
commit
9dd79d5957
|
@ -799,6 +799,11 @@ buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
|||
*value_out = file->settings.unimportant;
|
||||
}break;
|
||||
|
||||
case BufferSetting_Unkillable:
|
||||
{
|
||||
*value_out = (file->settings.never_kill || file->settings.unkillable);
|
||||
}break;
|
||||
|
||||
case BufferSetting_ReadOnly:
|
||||
{
|
||||
*value_out = file->settings.read_only;
|
||||
|
@ -837,14 +842,14 @@ buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
|||
}
|
||||
}break;
|
||||
|
||||
case BufferSetting_Unkillable:
|
||||
{
|
||||
file->settings.unkillable = (value != 0);
|
||||
}break;
|
||||
|
||||
case BufferSetting_ReadOnly:
|
||||
{
|
||||
if (value){
|
||||
file->settings.read_only = true;
|
||||
}
|
||||
else{
|
||||
file->settings.read_only = false;
|
||||
}
|
||||
file->settings.read_only = (value != 0);
|
||||
}break;
|
||||
|
||||
case BufferSetting_RecordsHistory:
|
||||
|
@ -943,7 +948,7 @@ buffer_kill(Application_Links *app, Buffer_ID buffer_id, Buffer_Kill_Flag flags)
|
|||
Editing_File *file = imp_get_file(models, buffer_id);
|
||||
Buffer_Kill_Result result = BufferKillResult_DoesNotExist;
|
||||
if (api_check_buffer(file)){
|
||||
if (!file->settings.never_kill){
|
||||
if (!file->settings.never_kill && !file->settings.unkillable){
|
||||
b32 needs_to_save = file_needs_save(file);
|
||||
if (!needs_to_save || (flags & BufferKill_AlwaysKill) != 0){
|
||||
Thread_Context *tctx = app->tctx;
|
||||
|
|
|
@ -31,6 +31,7 @@ struct Editing_File_Settings{
|
|||
b8 is_initialized;
|
||||
b8 unimportant;
|
||||
b8 read_only;
|
||||
b8 unkillable;
|
||||
b8 never_kill;
|
||||
};
|
||||
|
||||
|
|
|
@ -4321,6 +4321,18 @@ string_remove_last_folder(String_Const_u32 str){
|
|||
return(str);
|
||||
}
|
||||
|
||||
function b32
|
||||
string_looks_like_drive_letter(String_Const_u8 string){
|
||||
b32 result = false;
|
||||
if (string.size == 3 &&
|
||||
character_is_alpha(string.str[0]) &&
|
||||
string.str[1] == ':' &&
|
||||
character_is_slash(string.str[2])){
|
||||
result = true;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
function String_Const_char
|
||||
string_remove_front_of_path(String_Const_char str){
|
||||
i64 slash_pos = string_find_last_slash(str);
|
||||
|
|
|
@ -638,7 +638,11 @@ CUSTOM_DOC("Interactively open a file out of the file system.")
|
|||
if (HasFlag(attribs.flags, FileAttribute_IsDirectory)){
|
||||
set_hot_directory(app, full_file_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (string_looks_like_drive_letter(file_name)){
|
||||
set_hot_directory(app, file_name);
|
||||
continue;
|
||||
}
|
||||
if (query_create_folder(app, file_name)){
|
||||
set_hot_directory(app, full_file_name);
|
||||
continue;
|
||||
|
@ -687,7 +691,11 @@ CUSTOM_DOC("Interactively creates a new file.")
|
|||
if (HasFlag(attribs.flags, FileAttribute_IsDirectory)){
|
||||
set_hot_directory(app, full_file_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (string_looks_like_drive_letter(file_name)){
|
||||
set_hot_directory(app, file_name);
|
||||
continue;
|
||||
}
|
||||
if (query_create_folder(app, file_name)){
|
||||
set_hot_directory(app, full_file_name);
|
||||
continue;
|
||||
|
|
|
@ -178,6 +178,7 @@ enum{
|
|||
BufferSetting_Unimportant,
|
||||
BufferSetting_ReadOnly,
|
||||
BufferSetting_RecordsHistory,
|
||||
BufferSetting_Unkillable,
|
||||
};
|
||||
|
||||
api(custom)
|
||||
|
|
|
@ -275,7 +275,7 @@ static Command_Metadata fcoder_metacmd_table[230] = {
|
|||
{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 180 },
|
||||
{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 630 },
|
||||
{ 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, "w:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 190 },
|
||||
{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 753 },
|
||||
{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 761 },
|
||||
{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 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, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 },
|
||||
{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 },
|
||||
|
@ -316,8 +316,8 @@ static Command_Metadata fcoder_metacmd_table[230] = {
|
|||
{ 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, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 581 },
|
||||
{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 682 },
|
||||
{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 520 },
|
||||
{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 657 },
|
||||
{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 707 },
|
||||
{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 661 },
|
||||
{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 715 },
|
||||
{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 612 },
|
||||
{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 510 },
|
||||
{ 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, "w:\\4ed\\code\\custom\\4coder_code_index_listers.cpp", 48, 12 },
|
||||
|
@ -450,7 +450,7 @@ static Command_Metadata fcoder_metacmd_table[230] = {
|
|||
{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 403 },
|
||||
{ PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1524 },
|
||||
{ PROC_LINKS(test_double_backspace, 0), false, "test_double_backspace", 21, "Made for testing purposes (I should have deleted this if you are reading it let me know)", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 115 },
|
||||
{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 777 },
|
||||
{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 785 },
|
||||
{ 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, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 574 },
|
||||
{ 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, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 561 },
|
||||
{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 667 },
|
||||
|
|
Loading…
Reference in New Issue