fixed bug with close-all-code

master
Allen Webster 2016-06-06 13:33:23 -04:00
parent b6f86f4f8d
commit 201b7f65a4
2 changed files with 36 additions and 23 deletions

View File

@ -737,6 +737,11 @@ CUSTOM_COMMAND_SIG(close_all_code){
String extension;
Buffer_Summary buffer;
// TODO(allen): Get better memory constructs to the custom layer
// so that it doesn't have to rely on arbitrary limits like this one.
int buffers_to_close[2048];
int buffers_to_close_count = 0;
for (buffer = app->get_buffer_first(app);
buffer.exists;
app->get_buffer_next(app, &buffer)){
@ -746,11 +751,15 @@ CUSTOM_COMMAND_SIG(close_all_code){
match(extension, make_lit_string("hpp")) ||
match(extension, make_lit_string("c")) ||
match(extension, make_lit_string("h"))){
//
push_parameter(app, par_buffer_id, buffer.buffer_id);
exec_command(app, cmdid_kill_buffer);
buffers_to_close[buffers_to_close_count++] = buffer.buffer_id;
}
}
for (int i = 0; i < buffers_to_close_count; ++i){
push_parameter(app, par_buffer_id, buffers_to_close[i]);
exec_command(app, cmdid_kill_buffer);
}
}
CUSTOM_COMMAND_SIG(open_all_code){

View File

@ -1619,6 +1619,10 @@ view_set_file(View *view, Editing_File *file, Models *models){
view->font_advance = fnt_info->advance;
view->line_height = fnt_info->height;
if (view->file_data.file != 0){
touch_file(&models->working_set, view->file_data.file);
}
file_view_nullify_file(view);
view->file_data.file = file;
@ -3325,12 +3329,12 @@ try_kill_file(System_Functions *system, Models *models,
internal void
interactive_view_complete(System_Functions *system, View *view, String dest, i32 user_action){
Models *models = view->persistent.models;
Editing_File *old_file = view->file_data.file;
//Editing_File *old_file = view->file_data.file;
switch (view->action){
case IAct_Open:
view_open_file(system, models, view, dest);
touch_file(&models->working_set, old_file);
//touch_file(&models->working_set, old_file);
view_show_file(view);
break;
@ -3347,7 +3351,7 @@ interactive_view_complete(System_Functions *system, View *view, String dest, i32
case IAct_Switch:
{
touch_file(&models->working_set, old_file);
//touch_file(&models->working_set, old_file);
Editing_File *file = 0;
String string = dest;