up down better ux

This commit is contained in:
John McLear 2020-12-28 18:29:01 +00:00
parent 0fdc13a6ad
commit af6a699db4

View file

@ -3082,26 +3082,28 @@ function Ace2Inner() {
rep.selEnd[0] = rep.selEnd[0] + (visibleLineRange[1] - visibleLineRange[0]);
}
top.console.log(rep.selStart[0]);
if (rep.selStart[0] === -1) rep.selStart[0] = 0;
if (rep.selEnd[0] === -1) rep.selEnd[0] = 0;
if (rep.selStart[0] === -1) {
return rep.selStart[0] = 0;
}
if (rep.selEnd[0] === -1) {
return rep.selEnd[0] = 0;
}
// if the new rep is beyond the viewport
// put the caret on the last line at the end of the line
top.console.log(rep.selStart[0]);
if (rep.selStart[0] >= (linesLength - 1)) {
top.console.log('wait wut?');
top.console.log('wait wut?', rep.selStart[0], linesLength - 1);
let line;
// need current character length of line
try {
line = rep.lines.atIndex(rep.selEnd[0]);
} catch (e) {
// silently fail, no big deal..
line = rep.lines.atIndex(visibleLineRange[1]);
}
let lineLength;
if (line) { // need to test if this is needed or not.
lineLength = line.width;
} else {
lineLength = 0;
}
const lineLength = line.width;
rep.selStart = [linesLength - 1, lineLength];
rep.selEnd = [linesLength - 1, lineLength];
}