mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.0.1598: cannot select text in a terminal with the mouse
Problem: Cannot select text in a terminal with the mouse. Solution: When a job in a terminal is not consuming mouse events, use them for modeless selection. Also stop Insert mode when clicking in a terminal window.
This commit is contained in:
@@ -259,6 +259,19 @@ typedef struct {
|
||||
int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user);
|
||||
} VTermStateCallbacks;
|
||||
|
||||
typedef struct {
|
||||
VTermPos pos;
|
||||
int buttons;
|
||||
#define MOUSE_BUTTON_LEFT 0x01
|
||||
#define MOUSE_BUTTON_MIDDLE 0x02
|
||||
#define MOUSE_BUTTON_RIGHT 0x04
|
||||
int flags;
|
||||
#define MOUSE_WANT_CLICK 0x01
|
||||
#define MOUSE_WANT_DRAG 0x02
|
||||
#define MOUSE_WANT_MOVE 0x04
|
||||
/* useful to add protocol? */
|
||||
} VTermMouseState;
|
||||
|
||||
VTermState *vterm_obtain_state(VTerm *vt);
|
||||
|
||||
void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user);
|
||||
@@ -272,6 +285,7 @@ void *vterm_state_get_unrecognised_fbdata(VTermState *state);
|
||||
void vterm_state_reset(VTermState *state, int hard);
|
||||
|
||||
void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos);
|
||||
void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate);
|
||||
void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg);
|
||||
void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col);
|
||||
void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg);
|
||||
|
@@ -1793,6 +1793,14 @@ void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos)
|
||||
*cursorpos = state->pos;
|
||||
}
|
||||
|
||||
void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate)
|
||||
{
|
||||
mousestate->pos.col = state->mouse_col;
|
||||
mousestate->pos.row = state->mouse_row;
|
||||
mousestate->buttons = state->mouse_buttons;
|
||||
mousestate->flags = state->mouse_flags;
|
||||
}
|
||||
|
||||
void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user)
|
||||
{
|
||||
if(callbacks) {
|
||||
|
@@ -95,9 +95,6 @@ struct VTermState
|
||||
int mouse_col, mouse_row;
|
||||
int mouse_buttons;
|
||||
int mouse_flags;
|
||||
#define MOUSE_WANT_CLICK 0x01
|
||||
#define MOUSE_WANT_DRAG 0x02
|
||||
#define MOUSE_WANT_MOVE 0x04
|
||||
|
||||
enum { MOUSE_X10, MOUSE_UTF8, MOUSE_SGR, MOUSE_RXVT } mouse_protocol;
|
||||
|
||||
|
Reference in New Issue
Block a user