Bug 118629: Shift-LeftArrow-Copy picks up newline (caret renders in wrong place). Also fixes bug 308023. r+sr+a=roc

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@191240 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
uriber%gmail.com
2006-02-25 15:48:42 +00:00
parent d54c3fb106
commit ee835b6f1d

View File

@@ -778,7 +778,15 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
outString->Assign(tString);
if (curNode)
{
aSelection->Collapse(curNode, curOffset);
// Make the caret attach to the inserted text, unless this text ends with a LF,
// in which case make the caret attach to the next line.
PRBool endsWithLF = !tString.IsEmpty() && tString.get()[tString.Length() - 1] == nsCRT::LF;
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
selPrivate->SetInterlinePosition(endsWithLF);
}
}
return res;
}