Adding dirty file reloading
This commit is contained in:
parent
80b780278a
commit
0a03ea05f1
|
@ -80,7 +80,6 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
|
||||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||||
|
|
||||||
for (;;){
|
for (;;){
|
||||||
// NOTE(allen): Get input
|
|
||||||
User_Input input = get_next_input(app, EventPropertyGroup_Any, 0);
|
User_Input input = get_next_input(app, EventPropertyGroup_Any, 0);
|
||||||
if (input.abort){
|
if (input.abort){
|
||||||
break;
|
break;
|
||||||
|
@ -149,30 +148,42 @@ code_index_update_tick(Application_Links *app){
|
||||||
buffer_modified_set_clear();
|
buffer_modified_set_clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f32 time_since_last_dirty_buffers_check = 0;
|
||||||
|
function void
|
||||||
|
reload_clean_buffers_on_filesystem_change(Application_Links *app, Frame_Info frame_info)
|
||||||
|
{
|
||||||
|
time_since_last_dirty_buffers_check += frame_info.literal_dt;
|
||||||
|
if (time_since_last_dirty_buffers_check > 1)
|
||||||
|
{
|
||||||
|
time_since_last_dirty_buffers_check = 0;
|
||||||
|
for (Buffer_ID buffer = get_buffer_next(app, 0, Access_Always);
|
||||||
|
buffer != 0;
|
||||||
|
buffer = get_buffer_next(app, buffer, Access_Always)) {
|
||||||
|
Dirty_State dirty = buffer_get_dirty_state(app, buffer);
|
||||||
|
if (dirty == DirtyState_UnloadedChanges) {
|
||||||
|
buffer_reopen(app, buffer, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function void
|
function void
|
||||||
default_tick(Application_Links *app, Frame_Info frame_info){
|
default_tick(Application_Links *app, Frame_Info frame_info){
|
||||||
////////////////////////////////
|
|
||||||
// NOTE(allen): Update code index
|
|
||||||
|
|
||||||
code_index_update_tick(app);
|
code_index_update_tick(app);
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
// NOTE(allen): Update fade ranges
|
|
||||||
|
|
||||||
if (tick_all_fade_ranges(app, frame_info.animation_dt)){
|
if (tick_all_fade_ranges(app, frame_info.animation_dt)){
|
||||||
animate_in_n_milliseconds(app, 0);
|
animate_in_n_milliseconds(app, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
{ // Clear layouts if virtual whitespace setting changed
|
||||||
// NOTE(allen): Clear layouts if virtual whitespace setting changed.
|
|
||||||
|
|
||||||
{
|
|
||||||
b32 enable_virtual_whitespace = def_get_config_b32(vars_save_string_lit("enable_virtual_whitespace"));
|
b32 enable_virtual_whitespace = def_get_config_b32(vars_save_string_lit("enable_virtual_whitespace"));
|
||||||
if (enable_virtual_whitespace != def_enable_virtual_whitespace){
|
if (enable_virtual_whitespace != def_enable_virtual_whitespace){
|
||||||
def_enable_virtual_whitespace = enable_virtual_whitespace;
|
def_enable_virtual_whitespace = enable_virtual_whitespace;
|
||||||
clear_all_layouts(app);
|
clear_all_layouts(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reload_clean_buffers_on_filesystem_change(app, frame_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Rect_f32
|
function Rect_f32
|
||||||
|
|
Loading…
Reference in New Issue