fixed off-by-one in remeasure widths

master
Allen Webster 2016-07-04 00:04:39 -04:00
parent 8bcda623a8
commit cdcc01ec23
3 changed files with 9 additions and 4 deletions

View File

@ -801,19 +801,23 @@ view_open_file(Application_Links *app, View_Summary *view,
Buffer_Summary buffer = app->get_buffer_by_name(app, filename, filename_len, AccessProtected|AccessHidden); Buffer_Summary buffer = app->get_buffer_by_name(app, filename, filename_len, AccessProtected|AccessHidden);
if (buffer.exists){ if (buffer.exists){
if (!do_in_background){ if (!do_in_background){
if (view){
app->view_set_buffer(app, view, buffer.buffer_id, 0); app->view_set_buffer(app, view, buffer.buffer_id, 0);
} }
}
result = true; result = true;
} }
else{ else{
buffer = app->create_buffer(app, filename, filename_len, do_in_background); buffer = app->create_buffer(app, filename, filename_len, do_in_background);
if (!do_in_background){ if (!do_in_background){
if (buffer.exists){ if (buffer.exists){
if (view){
app->view_set_buffer(app, view, buffer.buffer_id, 0); app->view_set_buffer(app, view, buffer.buffer_id, 0);
result = true; result = true;
} }
} }
} }
}
return(result); return(result);
} }

View File

@ -779,6 +779,7 @@ buffer_remeasure_widths(Buffer_Type *buffer, float *advance_data,
assert_4tech(line_start <= line_end); assert_4tech(line_start <= line_end);
assert_4tech(line_count <= buffer->widths_max); assert_4tech(line_count <= buffer->widths_max);
++line_end;
if (line_shift != 0){ if (line_shift != 0){
memmove_4tech(widths + line_end + line_shift, widths + line_end, memmove_4tech(widths + line_end + line_shift, widths + line_end,
sizeof(float)*(widths_count - line_end)); sizeof(float)*(widths_count - line_end));

View File

@ -530,7 +530,7 @@ Win32AllocCoroutine(){
return(result); return(result);
} }
nternal void internal void
Win32FreeCoroutine(Win32_Coroutine *data){ Win32FreeCoroutine(Win32_Coroutine *data){
data->next = win32vars.coroutine_free; data->next = win32vars.coroutine_free;
win32vars.coroutine_free = data; win32vars.coroutine_free = data;