added *scratch*
This commit is contained in:
parent
69d617d406
commit
7c87b44c81
23
4ed.cpp
23
4ed.cpp
|
@ -2178,6 +2178,8 @@ App_Step_Sig(app_step){
|
|||
#endif
|
||||
|
||||
General_Memory *general = &models->mem.general;
|
||||
|
||||
{
|
||||
Editing_File *file = working_set_alloc_always(&models->working_set, general);
|
||||
file_create_read_only(system, models, file, "*messages*");
|
||||
working_set_add(system, &models->working_set, file, general);
|
||||
|
@ -2186,6 +2188,18 @@ App_Step_Sig(app_step){
|
|||
file->settings.unwrapped_lines = 1;
|
||||
|
||||
models->message_buffer = file;
|
||||
}
|
||||
|
||||
{
|
||||
Editing_File *file = working_set_alloc_always(&models->working_set, general);
|
||||
file_create_empty(system, models, file, "*scratch*");
|
||||
working_set_add(system, &models->working_set, file, general);
|
||||
file->settings.never_kill = 1;
|
||||
file->settings.unimportant = 1;
|
||||
file->settings.unwrapped_lines = 1;
|
||||
|
||||
models->scratch_buffer = file;
|
||||
}
|
||||
|
||||
if (models->hooks[hook_start]){
|
||||
models->hooks[hook_start](&models->app_links);
|
||||
|
@ -2220,6 +2234,14 @@ App_Step_Sig(app_step){
|
|||
if (i < models->layout.panel_count){
|
||||
view_set_file(panel->view, models->message_buffer, models);
|
||||
view_show_file(panel->view);
|
||||
|
||||
++i;
|
||||
panel = panel->next;
|
||||
}
|
||||
|
||||
for (;i < models->layout.panel_count; ++i, panel = panel->next){
|
||||
view_set_file(panel->view, models->scratch_buffer, models);
|
||||
view_show_file(panel->view);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2835,6 +2857,7 @@ App_Step_Sig(app_step){
|
|||
Panel *panel, *used_panels;
|
||||
used_panels = &models->layout.used_sentinel;
|
||||
for (dll_items(panel, used_panels)){
|
||||
update_view_line_height(models, panel->view);
|
||||
remeasure_file_view(system, panel->view);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ struct Models{
|
|||
Working_Set working_set;
|
||||
struct Live_Views *live_set;
|
||||
Editing_File *message_buffer;
|
||||
Editing_File *scratch_buffer;
|
||||
|
||||
char hot_dir_base_[256];
|
||||
Hot_Directory hot_directory;
|
||||
|
|
|
@ -1645,12 +1645,12 @@ file_view_nullify_file(View *view){
|
|||
|
||||
internal void
|
||||
view_set_file(View *view, Editing_File *file, Models *models){
|
||||
Font_Info *fnt_info;
|
||||
|
||||
#if 0
|
||||
// TODO(allen): This belongs somewhere else.
|
||||
fnt_info = get_font_info(models->font_set, models->global_font.font_id);
|
||||
Font_Info *fnt_info = get_font_info(models->font_set, models->global_font.font_id);
|
||||
view->font_advance = fnt_info->advance;
|
||||
view->line_height = fnt_info->height;
|
||||
#endif
|
||||
|
||||
if (view->file_data.file != 0){
|
||||
touch_file(&models->working_set, view->file_data.file);
|
||||
|
@ -3025,6 +3025,13 @@ style_get_color(Style *style, Cpp_Token token){
|
|||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
update_view_line_height(Models *models, View *view){
|
||||
Font_Info *fnt_info = get_font_info(models->font_set, models->global_font.font_id);
|
||||
view->font_advance = fnt_info->advance;
|
||||
view->line_height = fnt_info->height;
|
||||
}
|
||||
|
||||
internal void
|
||||
remeasure_file_view(System_Functions *system, View *view){
|
||||
if (file_is_ready(view->file_data.file)){
|
||||
|
@ -4489,7 +4496,6 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
}
|
||||
else{
|
||||
message = string_zero();
|
||||
|
||||
if (!file->settings.unimportant){
|
||||
switch (buffer_get_sync(file)){
|
||||
case SYNC_BEHIND_OS: message = message_unsynced; break;
|
||||
|
@ -4511,10 +4517,12 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
|||
file = reserved_files[i];
|
||||
|
||||
message = string_zero();
|
||||
if (!file->settings.unimportant){
|
||||
switch (buffer_get_sync(file)){
|
||||
case SYNC_BEHIND_OS: message = message_unsynced; break;
|
||||
case SYNC_UNSAVED: message = message_unsaved; break;
|
||||
}
|
||||
}
|
||||
|
||||
id.id[0] = (u64)(file);
|
||||
if (gui_do_file_option(target, id, file->name.live_name, 0, message)){
|
||||
|
@ -6210,6 +6218,8 @@ live_set_alloc_view(Live_Views *live_set, Panel *panel, Models *models){
|
|||
result.view->persistent.models = models;
|
||||
result.view->current_scroll = &result.view->recent.scroll;
|
||||
|
||||
update_view_line_height(models, result.view);
|
||||
|
||||
init_query_set(&result.view->query_set);
|
||||
|
||||
{
|
||||
|
|
|
@ -93,6 +93,9 @@ CUSTOM_COMMAND_SIG(change_active_panel_build){
|
|||
view = app->get_active_view(app, AccessAll);
|
||||
}
|
||||
}
|
||||
else{
|
||||
exec_command(app, cmdid_change_active_panel);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(allen): This is a bit nasty. I want a system for picking
|
||||
|
|
Loading…
Reference in New Issue