vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit f20c6809dd5547e2493fc9d625ae9693cdff8abc parent 86aad6e9b83bb8c6b43a09236e331a0f22f43e39 Author: Marc André Tanner <mat@brain-dump.org> Date: Sun, 5 Mar 2017 11:11:18 +0100 text-object: remove C implementation of file name text object This is no longer needed now that the completion logic was moved to Lua. Diffstat:
| M | text-objects.c | | | 27 | --------------------------- |
| M | text-objects.h | | | 3 | --- |
2 files changed, 0 insertions(+), 30 deletions(-)
diff --git a/text-objects.c b/text-objects.c @@ -255,33 +255,6 @@ Filerange text_object_backtick(Text *txt, size_t pos) { return text_object_bracket(txt, pos, '`'); } -Filerange text_object_range(Text *txt, size_t pos, int (*isboundary)(int)) { - char c; - size_t start; - Iterator it = text_iterator_get(txt, pos), rit = it; - if (!text_iterator_byte_get(&rit, &c) || boundary(c)) - return text_range_empty(); - char tmp = c; - do start = rit.pos; while (text_iterator_char_prev(&rit, &c) && !boundary(c)); - for (c = tmp; !boundary(c) && text_iterator_byte_next(&it, &c);); - return text_range_new(start, it.pos); -} - -static int is_filename_boundary(int c) { - switch (c) { - case ';': case ':': case '|': - case '"': case '\'': case '`': - case '<': case '>': - return true; - default: - return isspace(c); - } -} - -Filerange text_object_filename(Text *txt, size_t pos) { - return text_object_range(txt, pos, is_filename_boundary); -} - Filerange text_object_search_forward(Text *txt, size_t pos, Regex *regex) { size_t start = pos; size_t end = text_size(txt); diff --git a/text-objects.h b/text-objects.h @@ -39,9 +39,6 @@ Filerange text_object_paranthese(Text*, size_t pos); Filerange text_object_quote(Text*, size_t pos); Filerange text_object_single_quote(Text*, size_t pos); Filerange text_object_backtick(Text*, size_t pos); -/* text object delimited by arbitrary chars for which isboundary returns non-zero */ -Filerange text_object_range(Text*, size_t pos, int (*isboundary)(int)); -Filerange text_object_filename(Text*, size_t pos); /* match a search term in either forward or backward direction */ Filerange text_object_search_forward(Text*, size_t pos, Regex*); Filerange text_object_search_backward(Text*, size_t pos, Regex*);