Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/static/js/ace2_inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3731,6 +3731,33 @@ function Ace2Inner(){
updateBrowserSelectionFromRep();
}, 200);
}

/* Attempt to apply some sanity to cursor handling in Chrome after a copy / paste event
We have to do this the way we do because rep. doesn't hold the value for keyheld events IE if the user
presses and holds the arrow key */
if((evt.which == 37 || evt.which == 38 || evt.which == 39 || evt.which == 40) && $.browser.chrome){
var isLeftArrow = evt.which === 37;
var isUpArrow = evt.which === 38;
var isRightArrow = evt.which === 39;
var isDownArrow = evt.which === 40;

var newVisibleLineRange = getVisibleLineRange(); // get the current visible range -- This works great.
var lineHeight = textLineHeight(); // what Is the height of each line?
var myselection = document.getSelection(); // get the current caret selection, can't use rep. here because that only gives us the start position not the current
var caretOffsetTop = myselection.focusNode.parentNode.offsetTop; // get the carets selection offset in px IE 214

if((isUpArrow || isLeftArrow || isRightArrow || isDownArrow) && caretOffsetTop){ // was it an up arrow or left arrow?
var lineNum = Math.round(caretOffsetTop / lineHeight) ; // Get the current Line Number IE 84
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.
// Get the new Y by getting the line number and multiplying by the height of each line.
var newY = lineHeight * (lineNum -1); // -1 to go to the line above
setScrollY(newY); // set the scroll height of the browser
}
}
}

}

if (type == "keydown")
Expand Down Expand Up @@ -3836,7 +3863,6 @@ function Ace2Inner(){
selection.endPoint = getPointForLineAndChar(se);

selection.focusAtStart = !! rep.selFocusAtStart;

setSelection(selection);
}

Expand Down
2 changes: 2 additions & 0 deletions src/templates/timeslider.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
<% e.end_block(); %>

<link rel="localizations" type="application/l10n+json" href="../../locales.json" />
<% e.begin_block("timesliderScripts"); %>
<script type="text/javascript" src="../../static/js/html10n.js"></script>
<script type="text/javascript" src="../../static/js/l10n.js"></script>
<% e.end_block(); %>
</head>

<% e.begin_block("timesliderBody"); %>
Expand Down