Make it possible to modify rectangle selection modifiers

Signed-off-by: Jo De Boeck <deboeck.jo@gmail.com>
This commit is contained in:
Jo De Boeck 2017-12-24 18:40:25 +02:00
parent 1e2f7c705d
commit 60e17d5224
No known key found for this signature in database
GPG Key ID: E809C912CC8B6F67
5 changed files with 9 additions and 3 deletions

View File

@ -195,7 +195,7 @@ def parse_send_text(val, keymap):
return parse_key(key_str, keymap)
def to_open_url_modifiers(val):
def to_modifiers(val):
return parse_mods(val.split('+'))
@ -264,7 +264,8 @@ type_map = {
'font_size_delta': positive_float,
'focus_follows_mouse': to_bool,
'cursor_shape': to_cursor_shape,
'open_url_modifiers': to_open_url_modifiers,
'open_url_modifiers': to_modifiers,
'rectangle_select_modifiers': to_modifiers,
'repaint_delay': positive_int,
'input_delay': positive_int,
'window_border_width': positive_float,

View File

@ -66,6 +66,9 @@ selection_background #FFFACD
url_color #0087BD
url_style curly
# The modifiers to use rectangle selection
rectangle_select_modifiers ctrl+alt
# The cursor color
cursor #cccccc

View File

@ -111,7 +111,7 @@ update_drag(bool from_button, Window *w, bool is_release, int modifiers) {
Screen *screen = w->render_data.screen;
if (from_button) {
if (is_release) screen_update_selection(screen, w->mouse_cell_x, w->mouse_cell_y, true);
else screen_start_selection(screen, w->mouse_cell_x, w->mouse_cell_y, modifiers == (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
else screen_start_selection(screen, w->mouse_cell_x, w->mouse_cell_y, modifiers == (int)OPT(rectangle_select_modifiers));
} else if (screen->selection.in_progress) {
screen_update_selection(screen, w->mouse_cell_x, w->mouse_cell_y, false);
call_boss(set_primary_selection, NULL);

View File

@ -317,6 +317,7 @@ PYWRAP1(set_options) {
S(mouse_hide_wait, PyFloat_AsDouble);
S(wheel_scroll_multiplier, PyFloat_AsDouble);
S(open_url_modifiers, PyLong_AsUnsignedLong);
S(rectangle_select_modifiers, PyLong_AsUnsignedLong);
S(click_interval, PyFloat_AsDouble);
S(url_color, color_as_int);
S(background, color_as_int);

View File

@ -15,6 +15,7 @@ typedef struct {
bool enable_audio_bell;
CursorShape cursor_shape;
unsigned int open_url_modifiers;
unsigned int rectangle_select_modifiers;
unsigned int url_style;
char_type select_by_word_characters[256]; size_t select_by_word_characters_count;
color_type url_color, background;