bug fixes a4.0.1

master
Allen Webster 2016-03-07 11:51:49 -05:00
parent b62543188c
commit 1db0271749
4 changed files with 149 additions and 124 deletions

View File

@ -1056,7 +1056,8 @@ SCROLL_RULE_SIG(smooth_scroll_rule){
} }
#if Custom_Current == Custom_HandmadeHero #if Custom_Current == Custom_HandmadeHero
# include "power/4coder_handmade_hero.cpp" //# include "power/4coder_handmade_hero.cpp"
#include "custom_casey.cpp"
#endif #endif
extern "C" GET_BINDING_DATA(get_bindings){ extern "C" GET_BINDING_DATA(get_bindings){

View File

@ -252,7 +252,7 @@ get_first_view_with_buffer(Application_Links *app, int buffer_id){
for(test = app->get_view_first(app); for(test = app->get_view_first(app);
test.exists; test.exists;
app->get_view_next(app, &test)){ app->get_view_next(app, &test)){
if(test.buffer_id == buffer_id){ if(test.locked_buffer_id == buffer_id){
result = test; result = test;
break; break;
} }

40
4ed.cpp
View File

@ -969,6 +969,8 @@ COMMAND_DECL(reopen){
REQ_FILE(file, view); REQ_FILE(file, view);
USE_EXCHANGE(exchange); USE_EXCHANGE(exchange);
if (match(file->name.source_path, file->name.live_name)) return;
i32 file_id = exchange_request_file(exchange, expand_str(file->name.source_path)); i32 file_id = exchange_request_file(exchange, expand_str(file->name.source_path));
i32 index = 0; i32 index = 0;
if (file_id){ if (file_id){
@ -4080,6 +4082,13 @@ App_Step_Sig(app_step){
view_file_in_panel(cmd, binding->panel, ed_file); view_file_in_panel(cmd, binding->panel, ed_file);
} }
for (View_Iter iter = file_view_iter_init(&models->layout, ed_file, 0);
file_view_iter_good(iter);
iter = file_view_iter_next(iter)){
view_measure_wraps(system, general, iter.view);
view_cursor_move(iter.view, preload_settings.start_line, 0);
}
app_result.redraw = 1; app_result.redraw = 1;
} }
else{ else{
@ -4097,13 +4106,6 @@ App_Step_Sig(app_step){
app_result.redraw = 1; app_result.redraw = 1;
} }
for (View_Iter iter = file_view_iter_init(&models->layout, ed_file, 0);
file_view_iter_good(iter);
iter = file_view_iter_next(iter)){
view_measure_wraps(system, general, iter.view);
view_cursor_move(iter.view, preload_settings.start_line, 0);
}
exchange_free_file(exchange, binding->sys_id); exchange_free_file(exchange, binding->sys_id);
remove = 1; remove = 1;
} }
@ -4307,7 +4309,13 @@ App_Step_Sig(app_step){
case DACT_SWITCH: case DACT_SWITCH:
{ {
Editing_File *file = working_set_lookup_file(working_set, string); if (!file && string.str){
file = working_set_lookup_file(working_set, string);
if (!file){
file = working_set_contains(working_set, string);
}
}
if (file){ if (file){
View *view = panel->view; View *view = panel->view;
@ -4320,6 +4328,14 @@ App_Step_Sig(app_step){
case DACT_KILL: case DACT_KILL:
{ {
if (!file && string.str){
file = working_set_lookup_file(working_set, string);
if (!file){
file = working_set_contains(working_set, string);
}
}
if (file){ if (file){
table_remove(&working_set->table, file->name.source_path); table_remove(&working_set->table, file->name.source_path);
kill_file(system, exchange, models, file, kill_file(system, exchange, models, file,
@ -4337,6 +4353,14 @@ App_Step_Sig(app_step){
view = (models->layout.panels + models->layout.active_panel)->view; view = (models->layout.panels + models->layout.active_panel)->view;
} }
if (!file && string.str){
file = working_set_lookup_file(working_set, string);
if (!file){
file = working_set_contains(working_set, string);
}
}
if (file){ if (file){
if (buffer_needs_save(file)){ if (buffer_needs_save(file)){
view_show_interactive(system, view, &models->map_ui, view_show_interactive(system, view, &models->map_ui,

View File

@ -66,12 +66,12 @@ enum Color_View_Mode{
struct View{ struct View{
View *next, *prev; View *next, *prev;
b32 in_use; b32 in_use;
i32 id;
Models *models; Models *models;
Panel *panel; Panel *panel;
Command_Map *map; Command_Map *map;
i32 id;
Editing_File *file; Editing_File *file;
@ -2655,13 +2655,13 @@ interactive_view_complete(View *view){
break; break;
case IAct_Kill: case IAct_Kill:
delayed_try_kill(&models->delay1, view->dest, panel); delayed_try_kill(&models->delay1, view->dest);
break; break;
case IAct_Sure_To_Kill: case IAct_Sure_To_Kill:
switch (view->user_action){ switch (view->user_action){
case 0: case 0:
delayed_kill(&models->delay1, view->dest, panel); delayed_kill(&models->delay1, view->dest);
break; break;
case 1: case 1:
@ -2670,8 +2670,8 @@ interactive_view_complete(View *view){
case 2: case 2:
// TODO(allen): This is fishy! What if the save doesn't happen this time around? // TODO(allen): This is fishy! What if the save doesn't happen this time around?
// We need to ensure delayed acts happen in order I think. // We need to ensure delayed acts happen in order I think.
delayed_save(&models->delay1, view->dest, panel); delayed_save(&models->delay1, view->dest);
delayed_kill(&models->delay1, view->dest, panel); delayed_kill(&models->delay1, view->dest);
break; break;
} }
break; break;
@ -3532,7 +3532,7 @@ step_file_view(System_Functions *system, Exchange *exchange, View *view, i32_Rec
if (view->models->scroll_rule( if (view->models->scroll_rule(
view->target_x, view->target_y, view->target_x, view->target_y,
&view->scroll_x, &view->scroll_y, &view->scroll_x, &view->scroll_y,
view->id + 1, is_new_target)){ (view->id) + 1, is_new_target)){
result = 1; result = 1;
} }
@ -4129,11 +4129,11 @@ live_set_alloc_view(Live_Views *live_set, Panel *panel, Models *models){
++live_set->count; ++live_set->count;
result.view = live_set->free_sentinel.next; result.view = live_set->free_sentinel.next;
result.id = (i32)((char*)result.view - (char*)live_set->views); result.id = (i32)(result.view - live_set->views);
result.view->id = result.id;
dll_remove(result.view); dll_remove(result.view);
memset(result.view, 0, sizeof(View)); memset(result.view, 0, sizeof(View));
result.view->id = result.id;
result.view->in_use = 1; result.view->in_use = 1;
panel->view = result.view; panel->view = result.view;