fix issues with movement
This commit is contained in:
parent
ceec442bfe
commit
eebad002cd
11
libs/arg.c
11
libs/arg.c
|
@ -256,7 +256,16 @@ moveword(const Arg *arg)
|
||||||
void
|
void
|
||||||
movecursor(const Arg *arg)
|
movecursor(const Arg *arg)
|
||||||
{
|
{
|
||||||
cursor = nextrune(arg->i);
|
if (arg->i < 0) {
|
||||||
|
if (cursor > 0) {
|
||||||
|
cursor = nextrune(-1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (text[cursor]) {
|
||||||
|
cursor = nextrune(+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawmenu();
|
drawmenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
spmenu.c
2
spmenu.c
|
@ -393,7 +393,7 @@ nextrune(int inc)
|
||||||
// return location of next utf8 rune in the given direction (+1 or -1)
|
// return location of next utf8 rune in the given direction (+1 or -1)
|
||||||
for (n = cursor + inc; n + inc >= 0 && (text[n] & 0xc0) == 0x80; n += inc)
|
for (n = cursor + inc; n + inc >= 0 && (text[n] & 0xc0) == 0x80; n += inc)
|
||||||
;
|
;
|
||||||
return n;
|
return n ? n : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue