diff --git a/4coder_custom.h b/4coder_custom.h index 11b50cca..30b22a07 100644 --- a/4coder_custom.h +++ b/4coder_custom.h @@ -165,6 +165,7 @@ enum Command_ID{ enum{ CLI_OverlapWithConflict = 0x1, CLI_AlwaysBindToView = 0x2, + CLI_CursorAtEnd = 0x4, }; enum{ diff --git a/4coder_default_bindings.cpp b/4coder_default_bindings.cpp index c04e2bb2..65d87ffb 100644 --- a/4coder_default_bindings.cpp +++ b/4coder_default_bindings.cpp @@ -117,7 +117,7 @@ HOOK_SIG(my_start){ exec_command(app, cmdid_hide_scrollbar); app->change_theme(app, literal("4coder")); - app->change_font(app, literal("liberation sans")); + app->change_font(app, literal("Liberation Sans")); // Theme options: // "4coder" @@ -125,14 +125,14 @@ HOOK_SIG(my_start){ // "Twilight" // "Woverine" // "stb" - + // Font options: - // "liberation sans" - // "liberation mono" - // "hack" - // "cutive mono" - // "inconsolata" - + // "Liberation Sans" + // "Liberation Mono" + // "Hack" + // "Cutive Mono" + // "Inconsolata" + // no meaning for return return(0); } @@ -164,15 +164,11 @@ HOOK_SIG(my_file_settings){ wrap_lines = 0; } - // NOTE(allen|a4.0.5): Unlike previous versions the command cmdid_set_settings - // no longer automatically effects the active buffer. This command will actually be - // phased out in favor of an app call soon. - - // TODO(allen): also eliminate this hook if you can. app->buffer_set_setting(app, &buffer, BufferSetting_Lex, treat_as_code); app->buffer_set_setting(app, &buffer, BufferSetting_WrapLine, wrap_lines); app->buffer_set_setting(app, &buffer, BufferSetting_MapID, (treat_as_code)?((int)my_code_map):((int)mapid_file)); + // TODO(allen): eliminate this hook if you can. // no meaning for return return(0); } diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index fa96355a..d68564b8 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -256,11 +256,9 @@ clipboard_cut(Application_Links *app, int start, int end, Buffer_Summary *buffer Buffer_Summary buffer = {0}; int result = false; - if (buffer.exists){ - if (clipboard_copy(app, start, end, &buffer, access)){ - app->buffer_replace_range(app, &buffer, start, end, 0, 0); - if (buffer_out){*buffer_out = buffer;} - } + if (clipboard_copy(app, start, end, &buffer, access)){ + app->buffer_replace_range(app, &buffer, start, end, 0, 0); + if (buffer_out){*buffer_out = buffer;} } return(result); @@ -1137,7 +1135,9 @@ CUSTOM_COMMAND_SIG(open_all_code){ app->free_file_list(app, list); } -char out_buffer_space[1024], command_space[1024], hot_directory_space[1024]; +char out_buffer_space[1024]; +char command_space[1024]; +char hot_directory_space[1024]; CUSTOM_COMMAND_SIG(execute_any_cli){ Query_Bar bar_out, bar_cmd; @@ -1161,8 +1161,7 @@ CUSTOM_COMMAND_SIG(execute_any_cli){ buffer_identifier(bar_out.string.str, bar_out.string.size), hot_directory.str, hot_directory.size, bar_cmd.string.str, bar_cmd.string.size, - CLI_OverlapWithConflict); - + CLI_OverlapWithConflict | CLI_CursorAtEnd); } CUSTOM_COMMAND_SIG(execute_previous_cli){ @@ -1180,7 +1179,7 @@ CUSTOM_COMMAND_SIG(execute_previous_cli){ buffer_identifier(out_buffer.str, out_buffer.size), hot_directory.str, hot_directory.size, cmd.str, cmd.size, - CLI_OverlapWithConflict); + CLI_OverlapWithConflict | CLI_CursorAtEnd); } } diff --git a/4ed.cpp b/4ed.cpp index 5b2442b7..5f2e5ad6 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -26,6 +26,7 @@ struct App_State_Resizing{ struct CLI_Process{ CLI_Handles cli; Editing_File *out_file; + b32 cursor_at_end; }; struct CLI_List{ @@ -1871,10 +1872,10 @@ internal i32 update_cli_handle_with_file(System_Functions *system, Models *models, CLI_Handles *cli, Editing_File *file, char *dest, i32 max, b32 cursor_at_end){ i32 result = 0; - u32 amount; + u32 amount = 0; - for (system->cli_begin_update(cli); - system->cli_update_step(cli, dest, max, &amount);){ + system->cli_begin_update(cli); + if (system->cli_update_step(cli, dest, max, &amount)){ amount = eol_in_place_convert_in(dest, amount); output_file_append(system, models, file, make_string(dest, amount), cursor_at_end); result = 1; @@ -2090,7 +2091,7 @@ App_Step_Sig(app_step){ // NOTE(allen): update child processes if (input->dt > 0){ Temp_Memory temp = begin_temp_memory(&models->mem.part); - u32 max = Kbytes(32); + u32 max = Kbytes(128); char *dest = push_array(&models->mem.part, char, max); i32 count = vars->cli_processes.count; @@ -2099,7 +2100,8 @@ App_Step_Sig(app_step){ Editing_File *file = proc->out_file; if (file != 0){ - i32 r = update_cli_handle_with_file(system, models, &proc->cli, file, dest, max, 0); + i32 r = update_cli_handle_with_file( + system, models, &proc->cli, file, dest, max, proc->cursor_at_end); if (r < 0){ *proc = vars->cli_processes.procs[--count]; --i; diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 21038fab..742cf97b 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -289,6 +289,12 @@ EXEC_SYSTEM_COMMAND_SIG(external_exec_system_command){ proc = procs + vars->cli_processes.count++; proc->out_file = file; + if (flags & CLI_CursorAtEnd){ + proc->cursor_at_end = 1; + } + else{ + proc->cursor_at_end = 0; + } if (!system->cli_call(path_string.str, command_string.str, &proc->cli)){ --vars->cli_processes.count; diff --git a/README.txt b/README.txt index 0450d84c..1a9abc38 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -Distribution Date: 20.6.2016 (dd.mm.yyyy) +Distribution Date: 21.6.2016 (dd.mm.yyyy) Thank you for contributing to the 4coder project! diff --git a/SUPERREADME.txt b/SUPERREADME.txt index 927332aa..af051aab 100644 --- a/SUPERREADME.txt +++ b/SUPERREADME.txt @@ -1,4 +1,4 @@ -Distribution Date: 20.6.2016 (dd.mm.yyyy) +Distribution Date: 21.6.2016 (dd.mm.yyyy) Thank you for contributing to the 4coder project! diff --git a/power/4coder_casey.cpp b/power/4coder_casey.cpp index 12ae3486..08a0957a 100644 --- a/power/4coder_casey.cpp +++ b/power/4coder_casey.cpp @@ -1519,7 +1519,7 @@ HOOK_SIG(casey_start) exec_command(app, cmdid_change_active_panel); app->change_theme(app, literal("Handmade Hero")); - app->change_font(app, literal("liberation mono")); + app->change_font(app, literal("Liberation Mono")); Theme_Color colors[] = { diff --git a/power/4coder_chronal.cpp b/power/4coder_chronal.cpp index 5674a601..b9a7b8f2 100644 --- a/power/4coder_chronal.cpp +++ b/power/4coder_chronal.cpp @@ -38,7 +38,7 @@ HOOK_SIG(chronal_init){ exec_command(app, cmdid_change_active_panel); app->change_theme(app, literal("4coder")); - app->change_font(app, literal("hack")); + app->change_font(app, literal("Hack")); const int color_bg = 0x15100f; const int color_bar = 0x1c1212;