From cdcc01ec23864934a462de354bd7218379e077c9 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 4 Jul 2016 00:04:39 -0400 Subject: [PATCH] fixed off-by-one in remeasure widths --- 4coder_helper.h | 10 +++++++--- buffer/4coder_buffer_abstract.cpp | 1 + win32_4ed.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/4coder_helper.h b/4coder_helper.h index 1a2ba420..a7330b6b 100644 --- a/4coder_helper.h +++ b/4coder_helper.h @@ -801,7 +801,9 @@ view_open_file(Application_Links *app, View_Summary *view, Buffer_Summary buffer = app->get_buffer_by_name(app, filename, filename_len, AccessProtected|AccessHidden); if (buffer.exists){ if (!do_in_background){ - app->view_set_buffer(app, view, buffer.buffer_id, 0); + if (view){ + app->view_set_buffer(app, view, buffer.buffer_id, 0); + } } result = true; } @@ -809,8 +811,10 @@ view_open_file(Application_Links *app, View_Summary *view, buffer = app->create_buffer(app, filename, filename_len, do_in_background); if (!do_in_background){ if (buffer.exists){ - app->view_set_buffer(app, view, buffer.buffer_id, 0); - result = true; + if (view){ + app->view_set_buffer(app, view, buffer.buffer_id, 0); + result = true; + } } } } diff --git a/buffer/4coder_buffer_abstract.cpp b/buffer/4coder_buffer_abstract.cpp index 9a482635..436891a5 100644 --- a/buffer/4coder_buffer_abstract.cpp +++ b/buffer/4coder_buffer_abstract.cpp @@ -779,6 +779,7 @@ buffer_remeasure_widths(Buffer_Type *buffer, float *advance_data, assert_4tech(line_start <= line_end); assert_4tech(line_count <= buffer->widths_max); + ++line_end; if (line_shift != 0){ memmove_4tech(widths + line_end + line_shift, widths + line_end, sizeof(float)*(widths_count - line_end)); diff --git a/win32_4ed.cpp b/win32_4ed.cpp index aceb2aa5..3f41fdc0 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -530,7 +530,7 @@ Win32AllocCoroutine(){ return(result); } -nternal void +internal void Win32FreeCoroutine(Win32_Coroutine *data){ data->next = win32vars.coroutine_free; win32vars.coroutine_free = data;