I want to mimic the end of line shortcut behavior in macOS. I have this:
onKeyDown (event, change, next) {
if (event.key === 'ArrowRight') {
if (event.metaKey) {
event.preventDefault();
change.moveTo(5);
return true;
}
}
return next();
}
The problem is that now the offset index is a fixed 5
on change.moveTo(5)
.
How do I find the index of the last character of the current line?