fixed batch edit line counting bug; fixed font size parsing bug; fixed end of file indenting bug

master
Allen Webster 2017-06-17 19:41:27 -04:00
parent 92e5c30663
commit 0c7389415d
4 changed files with 26 additions and 12 deletions

25
4ed.cpp
View File

@ -738,8 +738,15 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
{
if (i + 1 < clparams.argc){
plat_settings->set_window_size = true;
plat_settings->window_w = str_to_int_c(clparams.argv[i]);
plat_settings->window_h = str_to_int_c(clparams.argv[i+1]);
i32 w = str_to_int_c(clparams.argv[i]);
i32 h = str_to_int_c(clparams.argv[i+1]);
if (w > 0){
plat_settings->window_w = w;
}
if (h > 0){
plat_settings->window_h = h;
}
++i;
}
@ -757,8 +764,15 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
{
if (i + 1 < clparams.argc){
plat_settings->set_window_pos = true;
plat_settings->window_x = str_to_int_c(clparams.argv[i]);
plat_settings->window_y = str_to_int_c(clparams.argv[i+1]);
i32 x = str_to_int_c(clparams.argv[i]);
i32 y = str_to_int_c(clparams.argv[i+1]);
if (x > 0){
plat_settings->window_x = x;
}
if (y > 0){
plat_settings->window_y = y;
}
++i;
}
@ -784,6 +798,7 @@ init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings,
{
if (i < clparams.argc){
plat_settings->font_size = str_to_int_c(clparams.argv[i]);
plat_settings->font_size = clamp_bottom(8, plat_settings->font_size);
}
action = CLAct_Nothing;
}break;
@ -847,7 +862,6 @@ App_Read_Command_Line_Sig(app_read_command_line){
SCROLL_RULE_SIG(fallback_scroll_rule){
b32 result = false;
if (target_x != *scroll_x){
*scroll_x = target_x;
result = true;
@ -856,7 +870,6 @@ SCROLL_RULE_SIG(fallback_scroll_rule){
*scroll_y = target_y;
result = true;
}
return(result);
}

View File

@ -1181,7 +1181,7 @@ wrap_state_consume_token(System_Functions *system, Render_Font *font, Code_Wrap_
state->i = i;
b32 consume_token = 0;
if (i >= state->token_ptr->start + state->token_ptr->size){
if (state->token_ptr < state->end_token && i >= state->token_ptr->start + state->token_ptr->size){
consume_token = 1;
}
@ -3503,13 +3503,12 @@ file_do_batch_edit(System_Functions *system, Models *models, Editing_File *file,
// it from cursor fixing is because you're a lazy asshole.
// NOTE(allen): meta data
Buffer_Measure_Starts measure_state = {};
buffer_measure_starts(&measure_state, &file->state.buffer);
file_measure_starts(general, &file->state.buffer);
Render_Font *font = system->font.get_render_data_by_id(file->settings.font_id);
// TODO(allen): write the remeasurement version
file_allocate_character_starts_as_needed(&models->mem.general, file);
file_allocate_character_starts_as_needed(general, file);
buffer_measure_character_starts(system, font, &file->state.buffer, file->state.character_starts, 0, file->settings.virtual_white);
file_measure_wraps(system, models, file, font);

View File

@ -751,6 +751,8 @@ font_load(System_Functions *system, Partition *part, Render_Font *font, i32 pt_s
internal void
system_set_page(System_Functions *system, Partition *part, Render_Font *font, Glyph_Page *page, u32 page_number, u32 pt_size, b32 use_hinting){
Assert(pt_size >= 8);
memset(page, 0, sizeof(*page));
if (part->base == 0){

View File

@ -87,6 +87,8 @@ Sys_Font_Free_Sig(system_font_free){
internal
Sys_Font_Init_Sig(system_font_init){
Assert(font_size >= 8);
Partition *scratch = &shared_vars.scratch;
Temp_Memory temp = begin_temp_memory(scratch);
@ -99,8 +101,6 @@ Sys_Font_Init_Sig(system_font_init){
font->allocate = system_font_allocate;
font->free = system_font_free;
font_size = clamp_bottom(8, font_size);
struct Font_Setup{
Font_Setup *next_font;
char *c_filename;