summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-12-12 19:54:49 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2021-12-13 07:53:59 +0100
commit1aa0a43d60336eb1f0e51805939a7cc00b377a2b (patch)
treee1f30e9d7d9de613dc25e567d8863cc5c21a20b8 /vcl
parent93389ff481297540378238891867df08a0c8e2be (diff)
tdf#145764 - Change behaviour of BASIC IDE Home Key
Pressing the Home Key moves the cursor to the first non-space character in the line, whereas pressing it at the first non-space character moves it to the beginning of that line Follow up of: I8eabb6d01b1a4de0d24bf064f82c83342ca91396 Change-Id: I9f4f0b2b602fa0158488959c2e2029f5da315771 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126702 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/edit/textview.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index b295b78af8b0..29dad16d1282 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1017,10 +1017,16 @@ TextSelection const & TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
case KEY_DOWN: aPaM = CursorDown( aPaM );
break;
case KEY_HOME:
- // tdf#145764 - move cursor to the beginning or first character in the same line
- aPaM = bCtrl ? CursorStartOfDoc()
- : aPaM.GetIndex() == 0 ? CursorFirstWord( aPaM )
- : CursorStartOfLine( aPaM );
+ if (bCtrl)
+ {
+ aPaM = CursorStartOfDoc();
+ }
+ else
+ {
+ // tdf#145764 - move cursor to the beginning or the first non-space character in the same line
+ const TextPaM aFirstWordPaM = CursorFirstWord(aPaM);
+ aPaM = aPaM.GetIndex() == aFirstWordPaM.GetIndex() ? CursorStartOfLine(aPaM) : aFirstWordPaM;
+ }
break;
case KEY_END: aPaM = bCtrl ? CursorEndOfDoc() : CursorEndOfLine( aPaM );
break;
@@ -1166,7 +1172,7 @@ TextPaM TextView::CursorFirstWord( const TextPaM& rPaM )
TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[aPaM.GetPara()].get();
css::uno::Reference<css::i18n::XBreakIterator> xBI = mpImpl->mpTextEngine->GetBreakIterator();
- aPaM.GetIndex() = xBI->nextWord(pNode->GetText(), 0, mpImpl->mpTextEngine->GetLocale(), css::i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos;
+ aPaM.GetIndex() = xBI->beginOfSentence(pNode->GetText(), 0, mpImpl->mpTextEngine->GetLocale());
return aPaM;
}