diff --git a/kmcomposewin.cpp b/kmcomposewin.cpp index fdb2b2240..bc5b434c5 100644 --- a/kmcomposewin.cpp +++ b/kmcomposewin.cpp @@ -4635,9 +4635,8 @@ void KMComposeWin::slotEditKeys() void KMComposeWin::setReplyFocus( bool hasMessage ) { mEditor->setFocus(); - if ( hasMessage ) { - mEditor->setCursorPosition( 1, 0 ); - } + if ( hasMessage ) + mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() ); } void KMComposeWin::setFocusToSubject() diff --git a/kmedit.cpp b/kmedit.cpp index 7599e9eec..8edf8edb5 100644 --- a/kmedit.cpp +++ b/kmedit.cpp @@ -759,4 +759,12 @@ void KMEdit::slotSpellDone() } } +void KMEdit::setCursorPositionFromStart( unsigned int pos ) { + unsigned int l = 0; + unsigned int c = 0; + posToRowCol( pos, l, c ); + setCursorPosition( l, c ); + ensureCursorVisible(); +} + #include "kmedit.moc" diff --git a/kmedit.h b/kmedit.h index 44f4c47d3..e58b0afc9 100644 --- a/kmedit.h +++ b/kmedit.h @@ -91,6 +91,10 @@ public: unsigned int lineBreakColumn() const; + /** set cursor to absolute position pos */ + void setCursorPositionFromStart(unsigned int pos); + + signals: void spellcheck_done( int result ); void attachPNGImageData( const QByteArray &image );