Macros | Functions
mouse.c File Reference
#include <stdbool.h>
#include "nvim/ascii.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
#include "nvim/fold.h"
#include "nvim/memline.h"
#include "nvim/misc1.h"
#include "nvim/mouse.h"
#include "nvim/move.h"
#include "nvim/os_unix.h"
#include "nvim/plines.h"
#include "nvim/screen.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/vim.h"
#include "nvim/window.h"


#define INCR()   nudge++; ptr_end += utfc_ptr2len(ptr_end)
#define DECR()   nudge--; ptr_end -= utfc_ptr2len(ptr_end)


int jump_to_mouse (int flags, bool *inclusive, int which_button)
bool mouse_comp_pos (win_T *win, int *rowp, int *colp, linenr_T *lnump)
win_Tmouse_find_win (int *gridp, int *rowp, int *colp)
void setmouse (void)
void set_mouse_topline (win_T *wp)
bool mouse_scroll_horiz (int dir)
int mouse_check_fold (void)

Macro Definition Documentation


#define DECR ( )    nudge--; ptr_end -= utfc_ptr2len(ptr_end)


#define INCR ( )    nudge++; ptr_end += utfc_ptr2len(ptr_end)

Function Documentation

◆ jump_to_mouse()

int jump_to_mouse ( int  flags,
bool inclusive,
int  which_button 

Move the cursor to the specified row and column on the screen. Change current window if necessary. Returns an integer with the CURSOR_MOVED bit set if the cursor has moved or unset otherwise.

The MOUSE_FOLD_CLOSE bit is set when clicked on the '-' in a fold column. The MOUSE_FOLD_OPEN bit is set when clicked on the '+' in a fold column.

If flags has MOUSE_FOCUS, then the current window will not be changed, and if the mouse is outside the window then the text will scroll, or if the mouse was previously on a status line, then the status line may be dragged.

If flags has MOUSE_MAY_VIS, then VIsual mode will be started before the cursor is moved unless the cursor was on a status line. This function returns one of IN_UNKNOWN, IN_BUFFER, IN_STATUS_LINE or IN_SEP_LINE depending on where the cursor was clicked.

If flags has MOUSE_MAY_STOP_VIS, then Visual mode will be stopped, unless the mouse is on the status line of the same window.

If flags has MOUSE_DID_MOVE, nothing is done if the mouse didn't move since the last call.

If flags has MOUSE_SETPOS, nothing is done, only the current position is remembered.

inclusiveused for inclusive operator, can be NULL

◆ mouse_check_fold()

int mouse_check_fold ( void  )

◆ mouse_comp_pos()

bool mouse_comp_pos ( win_T win,
int *  rowp,
int *  colp,
linenr_T lnump 

◆ mouse_find_win()

win_T* mouse_find_win ( int *  gridp,
int *  rowp,
int *  colp 

Find the window at "grid" position "*rowp" and "*colp". The positions are updated to become relative to the top-left of the window.

NULL when something is wrong.

◆ mouse_scroll_horiz()

bool mouse_scroll_horiz ( int  dir)

Do a horizontal scroll.

true if the cursor moved, false otherwise.

◆ set_mouse_topline()

void set_mouse_topline ( win_T wp)

◆ setmouse()

void setmouse ( void  )

Set UI mouse depending on current mode and 'mouse'.

Emits mouse_on/mouse_off UI event (unless 'mouse' is empty).