From 3a9b0faa06b712968ad8bc1d6e93e5ab2a6a6b4e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 6 Jun 2017 00:03:43 +0530 Subject: [PATCH] Be more positive ;) --- kitty/config.py | 24 ++++++++++++++---------- kitty/kitty.conf | 4 ++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/kitty/config.py b/kitty/config.py index c7ff5555a..60d55b995 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -150,34 +150,38 @@ def to_layout_names(raw): raise ValueError('The window layout {} is unknown'.format(p)) +def positive_int(x): + return max(0, int(x)) + + def positive_float(x): return max(0, float(x)) type_map = { - 'scrollback_lines': int, + 'scrollback_lines': positive_int, 'scrollback_pager': shlex.split, 'scrollback_in_new_tab': to_bool, 'font_size': to_font_size, - 'font_size_delta': float, + 'font_size_delta': positive_float, 'cursor_shape': to_cursor_shape, 'cursor_opacity': to_opacity, 'open_url_modifiers': to_open_url_modifiers, - 'repaint_delay': int, + 'repaint_delay': positive_int, 'window_border_width': positive_float, 'window_margin_width': positive_float, 'window_padding_width': positive_float, 'wheel_scroll_multiplier': float, - 'visual_bell_duration': float, + 'visual_bell_duration': positive_float, 'enable_audio_bell': to_bool, - 'click_interval': float, - 'mouse_hide_wait': float, - 'cursor_blink_interval': float, - 'cursor_stop_blinking_after': float, + 'click_interval': positive_float, + 'mouse_hide_wait': positive_float, + 'cursor_blink_interval': positive_float, + 'cursor_stop_blinking_after': positive_float, 'enabled_layouts': to_layout_names, 'remember_window_size': to_bool, - 'initial_window_width': int, - 'initial_window_height': int, + 'initial_window_width': positive_int, + 'initial_window_height': positive_int, 'use_system_wcwidth': to_bool, 'macos_hide_titlebar': to_bool, } diff --git a/kitty/kitty.conf b/kitty/kitty.conf index a96b4d225..b5cd0f3b9 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -45,7 +45,7 @@ cursor_shape block cursor_blink_interval 0.5 # Stop blinking cursor after the specified number of seconds of keyboard inactivity. Set to -# zero or a negative number to never stop blinking. +# zero to never stop blinking. cursor_stop_blinking_after 15.0 # Number of lines of history to keep in memory for scrolling back @@ -71,7 +71,7 @@ click_interval 0.5 select_by_word_characters :@-./_~?&=%+# # Hide mouse cursor after the specified number of seconds of the mouse not being used. Set to -# zero or a negative number to disable mouse cursor hiding. +# zero to disable mouse cursor hiding. mouse_hide_wait 3.0 # The enabled window layouts. A comma separated list of layout names. The special value * means