aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-04-04 09:22:26 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-04-04 09:31:49 +0200
commitca0b1fe1a590aa640fb20fcdfde3aeed3a0eac03 (patch)
tree3ed66754cf50cc2c38a93179f61e397f67778bb1 /text-motions.c
parentdd730eb1feb46e9688350b0ff401694653f90554 (diff)
downloadvis-ca0b1fe1a590aa640fb20fcdfde3aeed3a0eac03.tar.gz
vis-ca0b1fe1a590aa640fb20fcdfde3aeed3a0eac03.tar.xz
vis: add motions to move by codepoints
Some people might prefer this for <Backspace> behavior. Except for that and debugging purposes using `ga` and `g8` it is not yet that useful.
Diffstat (limited to 'text-motions.c')
-rw-r--r--text-motions.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/text-motions.c b/text-motions.c
index ee8220e..210e1f4 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -39,6 +39,18 @@ size_t text_char_prev(Text *txt, size_t pos) {
return it.pos;
}
+size_t text_codepoint_next(Text *txt, size_t pos) {
+ Iterator it = text_iterator_get(txt, pos);
+ text_iterator_codepoint_next(&it, NULL);
+ return it.pos;
+}
+
+size_t text_codepoint_prev(Text *txt, size_t pos) {
+ Iterator it = text_iterator_get(txt, pos);
+ text_iterator_codepoint_prev(&it, NULL);
+ return it.pos;
+}
+
static size_t find_next(Text *txt, size_t pos, const char *s, bool line) {
if (!s)
return pos;