make the focus jump back to the left if it's required

pull/1531/head
John McLear 2013-02-17 21:03:19 +00:00
parent 93d58b93be
commit 7e023ce8e1
1 changed files with 13 additions and 0 deletions

View File

@ -1622,10 +1622,19 @@ function Ace2Inner(){
lines = ccData.lines; lines = ccData.lines;
var lineAttribs = ccData.lineAttribs; var lineAttribs = ccData.lineAttribs;
var linesWrapped = ccData.linesWrapped; var linesWrapped = ccData.linesWrapped;
var scrollToTheLeftNeeded = false;
if (linesWrapped > 0) if (linesWrapped > 0)
{ {
if(browser.chrome){
// chrome decides in it's infinite wisdom that its okay to put the browsers visisble window in the middle of the span
// an outcome of this is that the first chars of the string are no longer visible to the user.. Yay chrome..
// Move the browsers visible area to the left hand side of the span
var scrollToTheLeftNeeded = true;
}
// console.log("Editor warning: " + linesWrapped + " long line" + (linesWrapped == 1 ? " was" : "s were") + " hard-wrapped into " + ccData.numLinesAfter + " lines."); // console.log("Editor warning: " + linesWrapped + " long line" + (linesWrapped == 1 ? " was" : "s were") + " hard-wrapped into " + ccData.numLinesAfter + " lines.");
}else{
var scrollToTheLeftNeeded = false;
} }
if (ss[0] >= 0) selStart = [ss[0] + a + netNumLinesChangeSoFar, ss[1]]; if (ss[0] >= 0) selStart = [ss[0] + a + netNumLinesChangeSoFar, ss[1]];
@ -1692,6 +1701,10 @@ function Ace2Inner(){
//console.log("removed: "+id); //console.log("removed: "+id);
}); });
if(scrollToTheLeftNeeded){ // needed to stop chrome from breaking the ui when long strings without spaces are pasted
$("#innerdocbody").scrollLeft(0);
}
p.mark("findsel"); p.mark("findsel");
// if the nodes that define the selection weren't encountered during // if the nodes that define the selection weren't encountered during
// content collection, figure out where those nodes are now. // content collection, figure out where those nodes are now.