summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-17 10:16:54 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-17 10:16:54 +0200
commit92a578f5e8714a61dfb668e3d76383d482b4fc31 (patch)
tree27e14f12591a9a42362026d8a9cf92a3bef968c2 /src
parentAutomatically focus on input when opening a dialog (diff)
downloadnheko-92a578f5e8714a61dfb668e3d76383d482b4fc31.tar.xz
Convert 'if' to 'else if' to remove a no-op
Diffstat (limited to 'src')
-rw-r--r--src/TextInputWidget.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc
index 72aa7f97..571df838 100644
--- a/src/TextInputWidget.cc
+++ b/src/TextInputWidget.cc
@@ -93,10 +93,8 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
                         ++history_index_;
                         setPlainText(working_history_[history_index_]);
                         moveCursor(QTextCursor::End);
-                }
-
-                // Move to the start of the text if there aren't any lines to move up to.
-                if (textCursor() == initial_cursor) {
+                } else if (textCursor() == initial_cursor) {
+                        // Move to the start of the text if there aren't any lines to move up to.
                         initial_cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor, 1);
                         setTextCursor(initial_cursor);
                 }
@@ -111,10 +109,8 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
                         --history_index_;
                         setPlainText(working_history_[history_index_]);
                         moveCursor(QTextCursor::End);
-                }
-
-                // Move to the end of the text if there aren't any lines to move down to.
-                if (textCursor() == initial_cursor) {
+                } else if (textCursor() == initial_cursor) {
+                        // Move to the end of the text if there aren't any lines to move down to.
                         initial_cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor, 1);
                         setTextCursor(initial_cursor);
                 }