aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
diff options
context:
space:
mode:
Diffstat (limited to 'text-motions.c')
-rw-r--r--text-motions.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/text-motions.c b/text-motions.c
index 69afcc7..85deab8 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -126,6 +126,14 @@ size_t text_line_finish(Text *txt, size_t pos) {
return it.pos;
}
+size_t text_line_lastchar(Text *txt, size_t pos) {
+ char c;
+ Iterator it = text_iterator_get(txt, text_line_end(txt, pos));
+ if (text_iterator_char_prev(&it, &c) && c == '\n')
+ text_iterator_byte_next(&it, NULL);
+ return it.pos;
+}
+
size_t text_line_end(Text *txt, size_t pos) {
char c;
Iterator it = text_iterator_get(txt, pos);