dont jump pages
parent
5441179e78
commit
ab81b5cfe9
|
@ -3742,6 +3742,7 @@ function Ace2Inner(){
|
|||
|
||||
if(caretOffsetTop){ // sometimes caretOffsetTop bugs out and returns 0, not sure why, possible Chrome bug? Either way if it does we don't wanna mess with it
|
||||
var lineNum = Math.round(caretOffsetTop / lineHeight) ; // Get the current Line Number IE 84
|
||||
newVisibleLineRange[1] = newVisibleLineRange[1]-1;
|
||||
var caretIsVisible = (lineNum > newVisibleLineRange[0] && lineNum < newVisibleLineRange[1]); // Is the cursor in the visible Range IE ie 84 > 14 and 84 < 90?
|
||||
if(!caretIsVisible){ // is the cursor no longer visible to the user?
|
||||
// Oh boy the caret is out of the visible area, I need to scroll the browser window to lineNum.
|
||||
|
@ -3749,7 +3750,7 @@ function Ace2Inner(){
|
|||
if(evt.which == 37 || evt.which == 38){ // If left or up
|
||||
var newY = lineHeight * (lineNum -1); // -1 to go to the line above
|
||||
}else if(evt.which == 39 || evt.which == 40){ // if down or right
|
||||
var newY = caretOffsetTop + lineHeight; // the offset and one additional line
|
||||
var newY = getScrollY() + (lineHeight*3); // the offset and one additional line
|
||||
}
|
||||
setScrollY(newY); // set the scroll height of the browser
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue