diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-13 22:35:26 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-13 22:35:26 +0200 |
| commit | 9da490af05b2aac772f0bdbb934dd313c1271749 (patch) | |
| tree | c21aa06e029e6d725baed9283e44990d22e38d72 | |
| parent | c17ca10e11db30f4b4924b69dbf3b1693025d4dc (diff) | |
| download | vis-9da490af05b2aac772f0bdbb934dd313c1271749.tar.gz vis-9da490af05b2aac772f0bdbb934dd313c1271749.tar.xz | |
Rename text_insert_raw to text_insert
| -rw-r--r-- | editor.c | 4 | ||||
| -rw-r--r-- | text.c | 6 | ||||
| -rw-r--r-- | text.h | 3 | ||||
| -rw-r--r-- | vis.c | 2 | ||||
| -rw-r--r-- | window.c | 4 |
5 files changed, 7 insertions, 12 deletions
@@ -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); } @@ -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 */ @@ -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 @@ -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) @@ -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 |
