From 5d9aa6aeb06d383ba2120c52cdb11104091d4a13 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 15 Jul 2016 11:45:02 -0400 Subject: [PATCH] quick bug fix, 4.0.10 totally ready --- 4ed_api_implementation.cpp | 51 +++++++++++++++++++------------------- build_all.bat | 4 +-- power/4coder_casey.cpp | 2 +- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 39568e74..5bfc5d24 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -792,21 +792,27 @@ DOC_SEE(Buffer_Batch_Edit_Type) bool32 result = false; if (file){ - Temp_Memory temp = begin_temp_memory(part); - Buffer_Edit *inverse_edits = push_array(part, Buffer_Edit, edit_count); - char *inv_str = (char*)part->base + part->pos; - int inv_str_max = part->max - part->pos; - Assert(inverse_edits); - - Edit_Spec spec = - file_compute_edit(mem, file, - edits, str, str_len, - inverse_edits, inv_str, inv_str_max, - edit_count, type); - - file_do_batch_edit(cmd->system, models, file, spec, hist_normal, type); - - end_temp_memory(temp); + if (edit_count > 0){ + Temp_Memory temp = begin_temp_memory(part); + Buffer_Edit *inverse_edits = push_array(part, Buffer_Edit, edit_count); + Assert(inverse_edits); + + char *inv_str = (char*)part->base + part->pos; + int inv_str_max = part->max - part->pos; + + Edit_Spec spec = + file_compute_edit(mem, file, + edits, str, str_len, + inverse_edits, inv_str, inv_str_max, + edit_count, type); + + file_do_batch_edit(cmd->system, models, file, spec, hist_normal, type); + + end_temp_memory(temp); + } + else{ + result = true; + } } return(result); @@ -1896,18 +1902,11 @@ DOC(This call changes 4coder's default font to one of the built in fonts.) i16 font_id = 0; if (font_set_extract(set, font_name, &font_id)){ - global_font->font_id = font_id; - if (apply_to_all_files){ - System_Functions *system = cmd->system; - Models *models = cmd->models; - - File_Node *node = 0; - File_Node *sentinel = &models->working_set.used_sentinel; - for (dll_items(node, sentinel)){ - Editing_File *file = (Editing_File*)node; - file_set_font(system, models, file, font_id); - } + global_set_font(cmd->system, cmd->models, font_id); + } + else{ + global_font->font_id = font_id; } } } diff --git a/build_all.bat b/build_all.bat index f0cc8bbb..046bc517 100644 --- a/build_all.bat +++ b/build_all.bat @@ -26,8 +26,8 @@ popd pushd ..\build REM call "%CODE_DIR%\buildsuper.bat" ..\code\4coder_default_bindings.cpp -call "%CODE_DIR%\buildsuper.bat" ..\code\power\4coder_experiments.cpp -REM call "%CODE_DIR%\buildsuper.bat" ..\code\power\4coder_casey.cpp +REM call "%CODE_DIR%\buildsuper.bat" ..\code\power\4coder_experiments.cpp +call "%CODE_DIR%\buildsuper.bat" ..\code\power\4coder_casey.cpp REM call "%CODE_DIR%\buildsuper.bat" ..\4vim\4coder_chronal.cpp if %ERRORLEVEL% neq 0 (set FirstError=1) diff --git a/power/4coder_casey.cpp b/power/4coder_casey.cpp index 16978fa3..649073bf 100644 --- a/power/4coder_casey.cpp +++ b/power/4coder_casey.cpp @@ -1474,7 +1474,7 @@ HOOK_SIG(casey_start) exec_command(app, change_active_panel); app->change_theme(app, literal("Handmade Hero")); - app->change_font(app, literal("Liberation Mono")); + app->change_font(app, literal("Liberation Mono"), true); Theme_Color colors[] = {