From 511337a68cf7329e08397631c48199641441d086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 23 Jul 2015 14:36:51 +0200 Subject: text-object: add text_range_linewise Takes a range and extends both ends to cover the remaining part of the line. --- text-objects.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'text-objects.c') 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; +} -- cgit v1.2.3