about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2021-05-25 21:28:56 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2021-05-25 21:28:56 +0200
commit34d7db276acc15c61e20d94bbfaee15f35552966 (patch)
tree833badede253738c4e5940fcde41d57649db7887
parentf7be01b88a14ccc3d406b13068e92eb9f33baa82 (diff)
terminal: Reset self.reset_history_index() directly
after reaching current entry. While at it, also attempt to clarify the
comment.
-rw-r--r--saneterm/terminal.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/saneterm/terminal.py b/saneterm/terminal.py
index 7ad301a..2fc92b2 100644
--- a/saneterm/terminal.py
+++ b/saneterm/terminal.py
@@ -161,9 +161,6 @@ class Terminal(Gtk.Window):
         self.hist_index = -1
 
     def history(self, termview, idx):
-        if self.hist_index is None:
-            self.reset_history_index()
-
         # Backup index and restore it if we hit the beginning of the history
         backup_index = self.hist_index
 
@@ -177,8 +174,9 @@ class Terminal(Gtk.Window):
                 self.hist_index = backup_index
                 return
             else:
-                # if we arrive at the present, just clear the line
-                self.hist_index = None
+                # we were going forward in time, but no newer entry
+                # was found. in this case we just clear the line
+                self.reset_history_index()
                 entry = ""
 
         self.termview.emit("kill-after-output")