Skip to content

Commit

Permalink
Merge f9aa0e7 into 9192b55
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym committed Dec 1, 2015
2 parents 9192b55 + f9aa0e7 commit 1b065e0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

VERSION = '3.2'

install_requires = ['psutil', 'colorama', 'six', 'decorator']
install_requires = ['psutil', 'colorama', 'six', 'decorator', 'win_unicode_console']
extras_require = {':python_version<"3.4"': ['pathlib']}

setup(name='thefuck',
Expand Down
2 changes: 2 additions & 0 deletions thefuck/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from warnings import warn
from pprint import pformat
import sys
import win_unicode_console
win_unicode_console.enable() #https://github.com/tartley/colorama/issues/32
import colorama
from . import logs, types, shells
from .conf import settings
Expand Down
14 changes: 13 additions & 1 deletion thefuck/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@
from . import logs

try:
from msvcrt import getch
import msvcrt
def getch():
ch = msvcrt.getch()
if ch in (b'\x00', b'\xe0'): # arrow or function key prefix?
ch = msvcrt.getch() # second call returns the actual key code

if ch == b'\x03':
raise KeyboardInterrupt
if ch == b'H':
return 'k'
if ch == b'P':
return 'j'
return ch.decode(sys.stdout.encoding)
except ImportError:
def getch():
import tty
Expand Down

0 comments on commit 1b065e0

Please sign in to comment.