Skip to content

Commit 0606134

Browse files
committed
Fix fish/tcsh history parsing and Python 3.12 history filtering
1 parent b6d89f5 commit 0606134

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

thefuck/utils.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,20 @@ def _not_corrected(history, tf_alias):
324324
from thefuck.shells import shell
325325
history = shell.get_history()
326326
tf_alias = get_alias()
327-
executables = set(get_all_executables())\
328-
.union(shell.get_builtin_commands())
329-
330-
return [line for line in _not_corrected(history, tf_alias)
331-
if not line.startswith(tf_alias) and not line == command.script
332-
and line.split(' ')[0] in executables]
327+
executables = set(get_all_executables()).union(shell.get_builtin_commands())
328+
329+
def _has_non_ascii(s):
330+
return any(ord(ch) > 127 for ch in s)
331+
332+
return [
333+
line for line in _not_corrected(history, tf_alias)
334+
if not line.startswith(tf_alias)
335+
and line != command.script
336+
and (
337+
line.split(' ')[0] in executables
338+
or _has_non_ascii(line)
339+
)
340+
]
333341

334342

335343
def format_raw_script(raw_script):

0 commit comments

Comments
 (0)