diff options
-rw-r--r-- | src/nvim/term.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/src/nvim/term.c b/src/nvim/term.c index 8e4efd69fb..b65e750974 100644 --- a/src/nvim/term.c +++ b/src/nvim/term.c @@ -2819,13 +2819,13 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) char_u bytes[6]; int num_bytes; # endif - long mouse_code = 0; /* init for GCC */ + int mouse_code = 0; /* init for GCC */ int is_click, is_drag; - long wheel_code = 0; - long current_button; - static long held_button = MOUSE_RELEASE; + int wheel_code = 0; + int current_button; + static int held_button = MOUSE_RELEASE; static int orig_num_clicks = 1; - static long orig_mouse_code = 0x0; + static int orig_mouse_code = 0x0; int cpo_koffset; cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL); @@ -3230,7 +3230,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) */ p = tp + slen; - mouse_code = get_long_digits(&p); + mouse_code = get_int_digits(&p); if (*p++ != ';') return -1; @@ -3269,7 +3269,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) } } p += j; - if (cmd_complete && get_long_digits(&p) == mouse_code) { + if (cmd_complete && get_int_digits(&p) == mouse_code) { slen += j; /* skip the \033[ */ continue; } @@ -3308,24 +3308,22 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) } # endif /* !UNIX || FEAT_MOUSE_XTERM */ if (key_name[0] == (int)KS_NETTERM_MOUSE) { - long mc, mr; + int mc, mr; /* expect a rather limited sequence like: balancing { * \033}6,45\r * '6' is the row, 45 is the column */ p = tp + slen; - mr = get_long_digits(&p); + mr = get_int_digits(&p); if (*p++ != ',') return -1; - mc = get_long_digits(&p); + mc = get_int_digits(&p); if (*p++ != '\r') return -1; - assert(mc - 1 >= INT_MIN && mc - 1 <= INT_MAX); - mouse_col = (int)(mc - 1); - assert(mr - 1 >= INT_MIN && mr - 1 <= INT_MAX); - mouse_row = (int)(mr - 1); + mouse_col = mc - 1; + mouse_row = mr - 1; mouse_code = MOUSE_LEFT; slen += (int)(p - (tp + slen)); } @@ -3380,32 +3378,32 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) * The page coordinate may be omitted if the locator is on * page one (the default). We ignore it anyway. */ - long Pe, Pb, Pr, Pc; + int Pe, Pb, Pr, Pc; p = tp + slen; /* get event status */ - Pe = get_long_digits(&p); + Pe = get_int_digits(&p); if (*p++ != ';') return -1; /* get button status */ - Pb = get_long_digits(&p); + Pb = get_int_digits(&p); if (*p++ != ';') return -1; /* get row status */ - Pr = get_long_digits(&p); + Pr = get_int_digits(&p); if (*p++ != ';') return -1; /* get column status */ - Pc = get_long_digits(&p); + Pc = get_int_digits(&p); /* the page parameter is optional */ if (*p == ';') { p++; - (void)get_long_digits(&p); + (void)get_int_digits(&p); } if (*p++ != '&') return -1; @@ -3449,10 +3447,8 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) default: return -1; /* should never occur */ } - assert(Pc - 1 >= INT_MIN && Pc - 1 <= INT_MAX); - mouse_col = (int)(Pc - 1); - assert(Pr - 1 >= INT_MIN && Pr - 1 <= INT_MAX); - mouse_row = (int)(Pr - 1); + mouse_col = Pc - 1; + mouse_row = Pr - 1; slen += (int)(p - (tp + slen)); } @@ -3540,8 +3536,7 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) key_name[1] = (wheel_code & 1) ? (int)KE_MOUSEUP : (int)KE_MOUSEDOWN; } else { - assert(current_button >= INT_MIN && current_button <= INT_MAX); - key_name[1] = (char_u)get_pseudo_mouse_code((int)current_button, + key_name[1] = (char_u)get_pseudo_mouse_code(current_button, is_click, is_drag); } } |