diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-02-07 16:04:54 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-02-07 16:18:25 +0100 |
| commit | 827575170a9c9a97ea0ccee32d4b0d4ceabb27a0 (patch) | |
| tree | 23caca67b93d559c72d726d18f24c08d7239121b /text-objects.c | |
| parent | 202146be752af88d7812dd3804e5234e692256ce (diff) | |
| download | vis-827575170a9c9a97ea0ccee32d4b0d4ceabb27a0.tar.gz vis-827575170a9c9a97ea0ccee32d4b0d4ceabb27a0.tar.xz | |
text-object: introduce text_object_filename
Diffstat (limited to 'text-objects.c')
| -rw-r--r-- | text-objects.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/text-objects.c b/text-objects.c index 3ea81e4..a0ffe3c 100644 --- a/text-objects.c +++ b/text-objects.c @@ -325,6 +325,21 @@ Filerange text_object_number(Text *txt, size_t pos) { return r; } +static int is_filename_boundary(int c) { + switch (c) { + 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_range_linewise(Text *txt, Filerange *rin) { Filerange rout = *rin; rout.start = text_line_begin(txt, rin->start); |
