1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-22 12:58:33 +00:00

#855 - Support Ukrainian layout; Fix matching of similar layouts (#856)

*  #855 - Support Ukrainian layout; Fix matching of similar layouts

* Fix splitting of command line
This commit is contained in:
kozar 2018-11-21 20:56:49 +02:00 committed by Vladimir Iakovlev
parent 1eaead4f70
commit dfd31872a9

View File

@ -4,6 +4,7 @@ from thefuck.utils import memoize, get_alias
target_layout = '''qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?'''
source_layouts = [u'''йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,''',
u'''йцукенгшщзхїфівапролджєячсмитьбю.ЙЦУКЕНГШЩЗХЇФІВАПРОЛДЖЄЯЧСМИТЬБЮ,''',
u'''ضصثقفغعهخحجچشسیبلاتنمکگظطزرذدپو./ًٌٍَُِّْ][}{ؤئيإأآة»«:؛كٓژٰ‌ٔء><؟''',
u''';ςερτυθιοπ[]ασδφγηξκλ΄ζχψωβνμ,./:΅ΕΡΤΥΘΙΟΠ{}ΑΣΔΦΓΗΞΚΛ¨"ΖΧΨΩΒΝΜ<>?''',
u'''/'קראטוןםפ][שדגכעיחלךף,זסבהנמצתץ.QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?''']
@ -15,7 +16,14 @@ def _get_matched_layout(command):
# result in a non-splitable sript as per shlex
cmd = command.script.split(' ')
for source_layout in source_layouts:
if all([ch in source_layout or ch in '-_' for ch in cmd[0]]):
is_all_match = True
for cmd_part in cmd:
if not all([ch in source_layout or ch in '-_' for ch in cmd_part]):
is_all_match = False
break
if is_all_match:
return source_layout