diff options
| -rw-r--r-- | text-objects.c | 8 | ||||
| -rw-r--r-- | text-objects.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/text-objects.c b/text-objects.c index 44515e1..815e36a 100644 --- a/text-objects.c +++ b/text-objects.c @@ -264,3 +264,11 @@ Filerange text_object_single_quote(Text *txt, size_t pos) { Filerange text_object_backtick(Text *txt, size_t pos) { return text_object_bracket(txt, pos, '`'); } + +Filerange text_range_linewise(Text *txt, Filerange *rin) { + Filerange rout = *rin; + rout.start = text_line_begin(txt, rin->start); + if (rin->end != text_line_begin(txt, rin->end)) + rout.end = text_line_next(txt, rin->end); + return rout; +} diff --git a/text-objects.h b/text-objects.h index a4babb5..3e08a91 100644 --- a/text-objects.h +++ b/text-objects.h @@ -32,4 +32,7 @@ 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); +/* extend a range to cover whole lines */ +Filerange text_range_linewise(Text*, Filerange*); + #endif |
