mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
up down better ux
This commit is contained in:
parent
0fdc13a6ad
commit
af6a699db4
1 changed files with 11 additions and 9 deletions
|
@ -3082,26 +3082,28 @@ function Ace2Inner() {
|
||||||
rep.selEnd[0] = rep.selEnd[0] + (visibleLineRange[1] - visibleLineRange[0]);
|
rep.selEnd[0] = rep.selEnd[0] + (visibleLineRange[1] - visibleLineRange[0]);
|
||||||
}
|
}
|
||||||
top.console.log(rep.selStart[0]);
|
top.console.log(rep.selStart[0]);
|
||||||
if (rep.selStart[0] === -1) rep.selStart[0] = 0;
|
if (rep.selStart[0] === -1) {
|
||||||
if (rep.selEnd[0] === -1) rep.selEnd[0] = 0;
|
return rep.selStart[0] = 0;
|
||||||
|
}
|
||||||
|
if (rep.selEnd[0] === -1) {
|
||||||
|
return rep.selEnd[0] = 0;
|
||||||
|
}
|
||||||
// if the new rep is beyond the viewport
|
// if the new rep is beyond the viewport
|
||||||
// put the caret on the last line at the end of the line
|
// 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)) {
|
if (rep.selStart[0] >= (linesLength - 1)) {
|
||||||
top.console.log('wait wut?');
|
top.console.log('wait wut?', rep.selStart[0], linesLength - 1);
|
||||||
let line;
|
let line;
|
||||||
// need current character length of line
|
// need current character length of line
|
||||||
try {
|
try {
|
||||||
line = rep.lines.atIndex(rep.selEnd[0]);
|
line = rep.lines.atIndex(rep.selEnd[0]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// silently fail, no big deal..
|
// silently fail, no big deal..
|
||||||
|
line = rep.lines.atIndex(visibleLineRange[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let lineLength;
|
const lineLength = line.width;
|
||||||
if (line) { // need to test if this is needed or not.
|
|
||||||
lineLength = line.width;
|
|
||||||
} else {
|
|
||||||
lineLength = 0;
|
|
||||||
}
|
|
||||||
rep.selStart = [linesLength - 1, lineLength];
|
rep.selStart = [linesLength - 1, lineLength];
|
||||||
rep.selEnd = [linesLength - 1, lineLength];
|
rep.selEnd = [linesLength - 1, lineLength];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue