From 9da490af05b2aac772f0bdbb934dd313c1271749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 13 Sep 2014 22:35:26 +0200 Subject: Rename text_insert_raw to text_insert --- editor.c | 4 ++-- text.c | 6 +----- text.h | 3 +-- vis.c | 2 +- window.c | 4 ++-- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/editor.c b/editor.c index 7ca69f1..9d520d8 100644 --- a/editor.c +++ b/editor.c @@ -412,7 +412,7 @@ void editor_delete_key(Editor *ed) { } void editor_insert(Editor *ed, size_t pos, const char *c, size_t len) { - text_insert_raw(ed->win->text, pos, c, len); + text_insert(ed->win->text, pos, c, len); editor_windows_invalidate(ed, pos, pos + len); } @@ -512,7 +512,7 @@ void editor_prompt_hide(Editor *ed) { void editor_prompt_set(Editor *ed, const char *line) { Text *text = ed->prompt->win->text; editor_prompt_clear(ed->prompt); - text_insert_raw(text, 0, line, strlen(line)); + text_insert(text, 0, line, strlen(line)); editor_window_draw(ed->prompt->win); } diff --git a/text.c b/text.c index 4f1f28e..7cdfd03 100644 --- a/text.c +++ b/text.c @@ -491,7 +491,7 @@ static void change_free(Change *c) { * | | |short| | existing text | | | * \-+ <-- +-----+ <-- +---------------+ <-- +-/ */ -bool text_insert_raw(Text *txt, size_t pos, const char *data, size_t len) { +bool text_insert(Text *txt, size_t pos, const char *data, size_t len) { if (pos > txt->size) return false; if (pos < txt->lines.pos) @@ -544,10 +544,6 @@ bool text_insert_raw(Text *txt, size_t pos, const char *data, size_t len) { return true; } -bool text_insert(Text *txt, size_t pos, const char *data) { - return text_insert_raw(txt, pos, data, strlen(data)); -} - size_t text_undo(Text *txt) { size_t pos = -1; /* taking a snapshot makes sure that txt->current_action is reset */ diff --git a/text.h b/text.h index f8b66ee..2343085 100644 --- a/text.h +++ b/text.h @@ -33,8 +33,7 @@ Text *text_load(const char *file); const char *text_filename_get(Text*); /* associate a filename with the yet unnamed buffer */ void text_filename_set(Text*, const char *filename); -bool text_insert(Text*, size_t pos, const char *data); -bool text_insert_raw(Text*, size_t pos, const char *data, size_t len); +bool text_insert(Text*, size_t pos, const char *data, size_t len); bool text_delete(Text*, size_t pos, size_t len); void text_snapshot(Text*); /* undo/redos to the last snapshoted state. returns the position where diff --git a/vis.c b/vis.c index dbdee71..a52fe9d 100644 --- a/vis.c +++ b/vis.c @@ -983,7 +983,7 @@ static bool cmd_read(const char *argv[]) { if (data == MAP_FAILED) goto err; - text_insert_raw(vis->win->text, pos, data, info.st_size); + text_insert(vis->win->text, pos, data, info.st_size); pos += info.st_size; err: if (fd > 2) diff --git a/window.c b/window.c index 3b579d6..59a275e 100644 --- a/window.c +++ b/window.c @@ -692,7 +692,7 @@ size_t window_backspace_key(Win *win) { size_t window_insert_key(Win *win, const char *c, size_t len) { size_t pos = win->cursor.pos; - text_insert_raw(win->text, pos, c, len); + text_insert(win->text, pos, c, len); if (win->cursor.line == win->bottomline && memchr(c, '\n', len)) window_scroll_lines_down(win, 1); else @@ -711,7 +711,7 @@ size_t window_replace_key(Win *win, const char *c, size_t len) { size_t oldlen = line->cells[cursor->col].len; text_delete(win->text, pos, oldlen); } - text_insert_raw(win->text, pos, c, len); + text_insert(win->text, pos, c, len); if (cursor->line == win->bottomline && memchr(c, '\n', len)) window_scroll_lines_down(win, 1); else -- cgit v1.2.3