mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 11:18:48 +00:00
Do not jump to next word end if already on a word end when selecting a
word. Fixes select-word with single character words and vi(1) keys. From Mark Kelly.
This commit is contained in:
parent
dc882adb2e
commit
f48b041cf2
@ -1521,14 +1521,26 @@ window_copy_cmd_select_word(struct window_copy_cmd_state *cs)
|
|||||||
struct session *s = cs->s;
|
struct session *s = cs->s;
|
||||||
struct window_copy_mode_data *data = wme->data;
|
struct window_copy_mode_data *data = wme->data;
|
||||||
const char *ws;
|
const char *ws;
|
||||||
|
u_int px, py, xx;
|
||||||
|
|
||||||
data->lineflag = LINE_SEL_LEFT_RIGHT;
|
data->lineflag = LINE_SEL_LEFT_RIGHT;
|
||||||
data->rectflag = 0;
|
data->rectflag = 0;
|
||||||
|
|
||||||
|
px = data->cx;
|
||||||
|
py = screen_hsize(data->backing) + data->cy - data->oy;
|
||||||
|
xx = window_copy_find_length(wme, py);
|
||||||
|
|
||||||
ws = options_get_string(s->options, "word-separators");
|
ws = options_get_string(s->options, "word-separators");
|
||||||
window_copy_cursor_previous_word(wme, ws, 0);
|
window_copy_cursor_previous_word(wme, ws, 0);
|
||||||
window_copy_start_selection(wme);
|
window_copy_start_selection(wme);
|
||||||
window_copy_cursor_next_word_end(wme, ws);
|
|
||||||
|
if (px >= xx || !window_copy_in_set(wme, px + 1, py, ws))
|
||||||
|
window_copy_cursor_next_word_end(wme, ws);
|
||||||
|
else {
|
||||||
|
window_copy_update_cursor(wme, px, data->cy);
|
||||||
|
if (window_copy_update_selection(wme, 1))
|
||||||
|
window_copy_redraw_lines(wme, data->cy, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return (WINDOW_COPY_CMD_REDRAW);
|
return (WINDOW_COPY_CMD_REDRAW);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user