Skip to content

Commit

Permalink
fix: goto next & previous word.
Browse files Browse the repository at this point in the history
Change-Id: I14d3740f8ad2bbf85bce87e8285c06454556fb49
  • Loading branch information
rekols committed Sep 17, 2018
1 parent 4b0b87e commit b344046
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 6 additions & 6 deletions editor/resource/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@
"key": "forwardword",
"name": "Forward word",
"type": "shortcut",
"default": "Alt+Right"
"default": "Ctrl+Right"
},
{
"key": "backwardword",
"name": "Backward word",
"type": "shortcut",
"default": "Alt+Left"
"default": "Ctrl+Left"
},
{
"key": "nextline",
Expand Down Expand Up @@ -634,13 +634,13 @@
"key": "forwardword",
"hide" : true,
"reset" : false,
"default": "Alt+Right"
"default": "Ctrl+Right"
},
{
"key": "backwardword",
"hide" : true,
"reset" : false,
"default": "Alt+Left"
"default": "Ctrl+Left"
},
{
"key": "nextline",
Expand Down Expand Up @@ -1526,13 +1526,13 @@
"key": "forwardword",
"hide" : true,
"reset" : false,
"default": "Alt+Right"
"default": "Ctrl+Right"
},
{
"key": "backwardword",
"hide" : true,
"reset" : false,
"default": "Alt+Left"
"default": "Ctrl+Left"
},
{
"key": "nextline",
Expand Down
12 changes: 8 additions & 4 deletions editor/src/texteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,11 @@ void TextEditor::forwardWord()
QTextCursor cursor = textCursor();

if (m_cursorMark) {
cursor.setPosition(getNextWordPosition(cursor, QTextCursor::KeepAnchor), QTextCursor::KeepAnchor);
// cursor.setPosition(getNextWordPosition(cursor, QTextCursor::KeepAnchor), QTextCursor::KeepAnchor);
cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
} else {
cursor.setPosition(getNextWordPosition(cursor, QTextCursor::MoveAnchor), QTextCursor::MoveAnchor);
// cursor.setPosition(getNextWordPosition(cursor, QTextCursor::MoveAnchor), QTextCursor::MoveAnchor);
cursor.movePosition(QTextCursor::NextWord, QTextCursor::MoveAnchor);
}

setTextCursor(cursor);
Expand All @@ -219,9 +221,11 @@ void TextEditor::backwardWord()
QTextCursor cursor = textCursor();

if (m_cursorMark) {
cursor.setPosition(getPrevWordPosition(cursor, QTextCursor::KeepAnchor), QTextCursor::KeepAnchor);
// cursor.setPosition(getPrevWordPosition(cursor, QTextCursor::KeepAnchor), QTextCursor::KeepAnchor);
cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
} else {
cursor.setPosition(getPrevWordPosition(cursor, QTextCursor::MoveAnchor), QTextCursor::MoveAnchor);
// cursor.setPosition(getPrevWordPosition(cursor, QTextCursor::MoveAnchor), QTextCursor::MoveAnchor);
cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor);
}

setTextCursor(cursor);
Expand Down

0 comments on commit b344046

Please sign in to comment.