cli hang bug fixed

master
Allen Webster 2016-06-21 13:43:25 -04:00
parent 69349fd749
commit 5144c3eed2
9 changed files with 35 additions and 31 deletions

View File

@ -165,6 +165,7 @@ enum Command_ID{
enum{
CLI_OverlapWithConflict = 0x1,
CLI_AlwaysBindToView = 0x2,
CLI_CursorAtEnd = 0x4,
};
enum{

View File

@ -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"
@ -127,11 +127,11 @@ HOOK_SIG(my_start){
// "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);
}

View File

@ -256,12 +256,10 @@ 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;}
}
}
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);
}
}

12
4ed.cpp
View File

@ -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;

View File

@ -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;

View File

@ -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!

View File

@ -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!

View File

@ -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[] =
{

View File

@ -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;