Skip to content

Commit

Permalink
[history] Don't add empty lines to the history.
Browse files Browse the repository at this point in the history
Caught by dogfooding during release.
  • Loading branch information
Andy Chu committed Mar 3, 2019
1 parent ff10d91 commit 60a37e3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/reader.py
Expand Up @@ -85,10 +85,10 @@ def _GetLine(self):
signal.signal(signal.SIGINT, signal.SIG_IGN)
# TODO: Should we restore the user-registered handler?

# Add the line if it's not EOL, the same as the previous line, and we have
# line_input.
if (line is not None and line != self.prev_line and
self.line_input is not None):
# Add the line if it's not EOL, not whitespace-only, not the same as the
# previous line, and we have line_input.
if (line is not None and line.strip() and
line != self.prev_line and self.line_input is not None):
self.line_input.add_history(line.rstrip()) # no trailing newlines
self.prev_line = line

Expand Down

0 comments on commit 60a37e3

Please sign in to comment.