aboutsummaryrefslogtreecommitdiff
path: root/text-objects.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-07-23 14:36:51 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-07-23 14:36:51 +0200
commit511337a68cf7329e08397631c48199641441d086 (patch)
tree60e37e8c16f2bb67e710bdc63baf6dcebc81d78a /text-objects.c
parentbe21d229b92a66c61feebc9a6f12c0957b0ba5c0 (diff)
downloadvis-511337a68cf7329e08397631c48199641441d086.tar.gz
vis-511337a68cf7329e08397631c48199641441d086.tar.xz
text-object: add text_range_linewise
Takes a range and extends both ends to cover the remaining part of the line.
Diffstat (limited to 'text-objects.c')
-rw-r--r--text-objects.c8
1 files changed, 8 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;
+}