From ee835b6f1dd57fa24f77559448ddfbc9e1c17b06 Mon Sep 17 00:00:00 2001 From: "uriber%gmail.com" Date: Sat, 25 Feb 2006 15:48:42 +0000 Subject: [PATCH] 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 --- mozilla/editor/libeditor/text/nsTextEditRules.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mozilla/editor/libeditor/text/nsTextEditRules.cpp b/mozilla/editor/libeditor/text/nsTextEditRules.cpp index 059428bdb96..5459b8ee015 100644 --- a/mozilla/editor/libeditor/text/nsTextEditRules.cpp +++ b/mozilla/editor/libeditor/text/nsTextEditRules.cpp @@ -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; + nsCOMPtrselPrivate(do_QueryInterface(aSelection)); + selPrivate->SetInterlinePosition(endsWithLF); + } } return res; }