diff --git a/4coder_insertion.cpp b/4coder_insertion.cpp index b214e250..01876abf 100644 --- a/4coder_insertion.cpp +++ b/4coder_insertion.cpp @@ -40,6 +40,8 @@ insertf(Buffer_Insertion *insertion, char *format, ...){ va_list args; va_start(args, format); + // TODO(casey): Allen, ideally we would have our own formatted here that could handle our string type, via %S or something, so + // we don't have to keep doing %.*s and passing two parameters and all that garbage. i32 result = vsprintf(temp, format, args); va_end(args); @@ -97,5 +99,16 @@ insert_line_from_buffer(Buffer_Insertion *insertion, Buffer_ID buffer_id, i32 li return(insert_line_from_buffer(insertion, buffer_id, line, 0)); } +static b32 +insert_mirror_range(Buffer_Insertion *insertion, Buffer_ID source, i32 source_first, i32 length) +{ + b32 result = mirror_buffer_insert_range(insertion->app, insertion->buffer, source, insertion->at, source_first, length); + if(result) + { + insertion->at += length; + } + return(result); +} + // BOTTOM diff --git a/4coder_mirror.cpp b/4coder_mirror.cpp index 580bb1d5..bf195502 100644 --- a/4coder_mirror.cpp +++ b/4coder_mirror.cpp @@ -597,6 +597,9 @@ mirror_buffer_insert_range(Application_Links *app, Buffer_ID mirror, Buffer_ID s if (mode == MirrorMode_Constructing){ b32 did_insert = false; { + // TODO(casey): Allen, this is going to be suuuuuper slow - it has to do a whole memory block + // reserve just to get the temporary space. This is the kind of thing that would be super simple and + // very efficient with a stack off the app pointer. Arena arena = make_arena(app, (8 << 10)); char *buffer = push_array(&arena, char, length); if (buffer_read_range(app, source, source_first, source_first + length, buffer)){ diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 55a9dca7..c289dfa9 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -4758,9 +4758,31 @@ Get_Process_State(Application_Links *app, Buffer_ID buffer_id) result.is_updating = file->is_updating; result.return_code = file->return_code; } + +*/ + +API_EXPORT Range +Get_View_Visible_Range(Application_Links *app, View_ID view_id) +{ + Range result = {}; + + // TODO(casey): Allen, I leave it to you to actually compute this the way you want. Hopefully all + // this sort of thing will get sorted out as the render/layout stuff becomes more disentangled. + Models *models = (Models*)app->cmd_context; + View *view = imp_get_view(models, view_id); + if(view && view->panel) + { + i32 view_height = rect_height(view->panel->rect_inner); + + Full_Cursor min_cursor = view_get_render_cursor(models->system, view); + Full_Cursor max_cursor; + view_compute_cursor(app, view_id, seek_xy(min_cursor.wrapped_x, min_cursor.wrapped_y + view_height, false, false), &max_cursor); + + result.min = min_cursor.pos; + result.max = max_cursor.pos; + } return(result); } -*/ // BOTTOM