This commit is contained in:
Kovid Goyal 2018-12-29 08:08:24 +05:30
parent fd298256d7
commit 06c5127856
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -115,7 +115,7 @@ def float_parse(func, rest):
@func_with_args('change_font_size') @func_with_args('change_font_size')
def parse_change_font_size(func, rest): def parse_change_font_size(func, rest):
vals = rest.split(' ', 1) vals = rest.strip().split(' ', 1)
if len(vals) != 2: if len(vals) != 2:
log_error('Invalid change_font_size specification: {}, treating it as default'.format(rest)) log_error('Invalid change_font_size specification: {}, treating it as default'.format(rest))
args = [True, None, 0] args = [True, None, 0]
@ -125,13 +125,13 @@ def parse_change_font_size(func, rest):
if amt[0] in '+-': if amt[0] in '+-':
args[1] = amt[0] args[1] = amt[0]
amt = amt[1:] amt = amt[1:]
args[2] = float(amt) args[2] = float(amt.strip())
return func, args return func, args
@func_with_args('clear_terminal') @func_with_args('clear_terminal')
def clear_terminal(func, rest): def clear_terminal(func, rest):
vals = rest.split(' ', 1) vals = rest.strip().split(' ', 1)
if len(vals) != 2: if len(vals) != 2:
log_error('clear_terminal needs two arguments, using defaults') log_error('clear_terminal needs two arguments, using defaults')
args = ['reset', 'active'] args = ['reset', 'active']
@ -152,7 +152,7 @@ def neighboring_window(func, rest):
@func_with_args('resize_window') @func_with_args('resize_window')
def resize_window(func, rest): def resize_window(func, rest):
vals = rest.split(' ', 1) vals = rest.strip().split(' ', 1)
if len(vals) > 2: if len(vals) > 2:
log_error('resize_window needs one or two arguments, using defaults') log_error('resize_window needs one or two arguments, using defaults')
args = ['wider', 1] args = ['wider', 1]
@ -205,7 +205,7 @@ def nth_window(func, rest):
def parse_key_action(action): def parse_key_action(action):
parts = action.split(' ', 1) parts = action.strip().split(' ', 1)
func = parts[0] func = parts[0]
if len(parts) == 1: if len(parts) == 1:
return KeyAction(func, ()) return KeyAction(func, ())
@ -216,6 +216,7 @@ def parse_key_action(action):
func, args = parser(func, rest) func, args = parser(func, rest)
except Exception: except Exception:
log_error('Ignoring invalid key action: {}'.format(action)) log_error('Ignoring invalid key action: {}'.format(action))
else:
return KeyAction(func, args) return KeyAction(func, args)