mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
API: Implement functions for deleting lines
This commit is contained in:
parent
8eb67404f0
commit
607d4acfb2
@ -67,6 +67,12 @@ void buffer_set_line(Buffer buffer, int64_t index, String line, Error *err)
|
||||
buffer_set_slice(buffer, index, index, true, true, array, err);
|
||||
}
|
||||
|
||||
void buffer_del_line(Buffer buffer, int64_t index, Error *err)
|
||||
{
|
||||
StringArray array = {.size = 0};
|
||||
buffer_set_slice(buffer, index, index, true, true, array, err);
|
||||
}
|
||||
|
||||
StringArray buffer_get_slice(Buffer buffer,
|
||||
int64_t start,
|
||||
int64_t end,
|
||||
|
@ -29,6 +29,13 @@ String buffer_get_line(Buffer buffer, int64_t index, Error *err);
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void buffer_set_line(Buffer buffer, int64_t index, String line, Error *err);
|
||||
|
||||
/// Deletes a buffer line
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param index The line index
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void buffer_del_line(Buffer buffer, int64_t index, Error *err);
|
||||
|
||||
/// Retrieves a line range from the buffer
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
|
@ -141,6 +141,11 @@ void vim_set_current_line(String line, Error *err)
|
||||
buffer_set_line(curbuf->b_fnum, curwin->w_cursor.lnum - 1, line, err);
|
||||
}
|
||||
|
||||
void vim_del_current_line(Error *err)
|
||||
{
|
||||
buffer_del_line(curbuf->b_fnum, curwin->w_cursor.lnum - 1, err);
|
||||
}
|
||||
|
||||
Object vim_get_var(bool special, String name, bool pop, Error *err)
|
||||
{
|
||||
return dict_get_value(special ? &vimvardict : &globvardict, name,
|
||||
|
@ -50,6 +50,11 @@ void vim_change_directory(String dir, Error *err);
|
||||
/// @return The current line string
|
||||
String vim_get_current_line(Error *err);
|
||||
|
||||
/// Delete the current line
|
||||
///
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_del_current_line(Error *err);
|
||||
|
||||
/// Sets the current line
|
||||
///
|
||||
/// @param line The line contents
|
||||
|
Loading…
Reference in New Issue
Block a user