mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Select the correct word for select-word when already at the start of a
word, GitHub issue 1820.
This commit is contained in:
parent
49bf7dc77e
commit
3d660b0023
@ -110,7 +110,7 @@ static void window_copy_cursor_next_word(struct window_mode_entry *,
|
|||||||
static void window_copy_cursor_next_word_end(struct window_mode_entry *,
|
static void window_copy_cursor_next_word_end(struct window_mode_entry *,
|
||||||
const char *);
|
const char *);
|
||||||
static void window_copy_cursor_previous_word(struct window_mode_entry *,
|
static void window_copy_cursor_previous_word(struct window_mode_entry *,
|
||||||
const char *);
|
const char *, int);
|
||||||
static void window_copy_scroll_up(struct window_mode_entry *, u_int);
|
static void window_copy_scroll_up(struct window_mode_entry *, u_int);
|
||||||
static void window_copy_scroll_down(struct window_mode_entry *, u_int);
|
static void window_copy_scroll_down(struct window_mode_entry *, u_int);
|
||||||
static void window_copy_rectangle_toggle(struct window_mode_entry *);
|
static void window_copy_rectangle_toggle(struct window_mode_entry *);
|
||||||
@ -1048,7 +1048,7 @@ window_copy_cmd_previous_matching_bracket(struct window_copy_cmd_state *cs)
|
|||||||
tried = 1;
|
tried = 1;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
window_copy_cursor_previous_word(wme, "}]) ");
|
window_copy_cursor_previous_word(wme, "}]) ", 1);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1343,7 +1343,7 @@ window_copy_cmd_previous_space(struct window_copy_cmd_state *cs)
|
|||||||
u_int np = wme->prefix;
|
u_int np = wme->prefix;
|
||||||
|
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_previous_word(wme, " ");
|
window_copy_cursor_previous_word(wme, " ", 1);
|
||||||
return (WINDOW_COPY_CMD_NOTHING);
|
return (WINDOW_COPY_CMD_NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1357,7 +1357,7 @@ window_copy_cmd_previous_word(struct window_copy_cmd_state *cs)
|
|||||||
|
|
||||||
ws = options_get_string(s->options, "word-separators");
|
ws = options_get_string(s->options, "word-separators");
|
||||||
for (; np != 0; np--)
|
for (; np != 0; np--)
|
||||||
window_copy_cursor_previous_word(wme, ws);
|
window_copy_cursor_previous_word(wme, ws, 1);
|
||||||
return (WINDOW_COPY_CMD_NOTHING);
|
return (WINDOW_COPY_CMD_NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1477,7 +1477,7 @@ window_copy_cmd_select_word(struct window_copy_cmd_state *cs)
|
|||||||
data->rectflag = 0;
|
data->rectflag = 0;
|
||||||
|
|
||||||
ws = options_get_string(s->options, "word-separators");
|
ws = options_get_string(s->options, "word-separators");
|
||||||
window_copy_cursor_previous_word(wme, ws);
|
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);
|
window_copy_cursor_next_word_end(wme, ws);
|
||||||
|
|
||||||
@ -3314,7 +3314,7 @@ window_copy_cursor_next_word_end(struct window_mode_entry *wme,
|
|||||||
/* Move to the previous place where a word begins. */
|
/* Move to the previous place where a word begins. */
|
||||||
static void
|
static void
|
||||||
window_copy_cursor_previous_word(struct window_mode_entry *wme,
|
window_copy_cursor_previous_word(struct window_mode_entry *wme,
|
||||||
const char *separators)
|
const char *separators, int already)
|
||||||
{
|
{
|
||||||
struct window_copy_mode_data *data = wme->data;
|
struct window_copy_mode_data *data = wme->data;
|
||||||
u_int px, py;
|
u_int px, py;
|
||||||
@ -3323,6 +3323,7 @@ window_copy_cursor_previous_word(struct window_mode_entry *wme,
|
|||||||
py = screen_hsize(data->backing) + data->cy - data->oy;
|
py = screen_hsize(data->backing) + data->cy - data->oy;
|
||||||
|
|
||||||
/* Move back to the previous word character. */
|
/* Move back to the previous word character. */
|
||||||
|
if (already || window_copy_in_set(wme, px, py, separators)) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (px > 0) {
|
if (px > 0) {
|
||||||
px--;
|
px--;
|
||||||
@ -3344,6 +3345,7 @@ window_copy_cursor_previous_word(struct window_mode_entry *wme,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Move back to the beginning of this word. */
|
/* Move back to the beginning of this word. */
|
||||||
while (px > 0 && !window_copy_in_set(wme, px - 1, py, separators))
|
while (px > 0 && !window_copy_in_set(wme, px - 1, py, separators))
|
||||||
|
Loading…
Reference in New Issue
Block a user