From 550938e49870f4811df08b8f1e902e48fbf1080f Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Sat, 10 May 2014 23:41:14 -0300 Subject: API: Implement `buffer_insert` --- src/api/buffer.c | 4 ++-- src/api/buffer.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/api/buffer.c b/src/api/buffer.c index 956c88dd75..ccc63aeee2 100644 --- a/src/api/buffer.c +++ b/src/api/buffer.c @@ -315,9 +315,9 @@ bool buffer_is_valid(Buffer buffer) abort(); } -void buffer_insert(Buffer buffer, StringArray lines, int64_t lnum, Error *err) +void buffer_insert(Buffer buffer, int64_t index, StringArray lines, Error *err) { - abort(); + buffer_set_slice(buffer, index, index, false, true, lines, err); } Position buffer_mark(Buffer buffer, String name, Error *err) diff --git a/src/api/buffer.h b/src/api/buffer.h index 343aac956d..1e7ec07ec5 100644 --- a/src/api/buffer.h +++ b/src/api/buffer.h @@ -127,11 +127,11 @@ bool buffer_is_valid(Buffer buffer); /// Inserts a sequence of lines to a buffer at a certain index /// /// @param buffer The buffer handle -/// @param lines An array of lines /// @param lnum Insert the lines before `lnum`. If negative, it will append /// to the end of the buffer. +/// @param lines An array of lines /// @param[out] err Details of an error that may have occurred -void buffer_insert(Buffer buffer, StringArray lines, int64_t lnum, Error *err); +void buffer_insert(Buffer buffer, int64_t index, StringArray lines, Error *err); /// Creates a mark in the buffer and returns a tuple(row, col) representing /// the position of the named mark -- cgit