Data Structures | Macros | Functions | Variables
screen.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include "nvim/api/extmark.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
#include "nvim/api/vim.h"
#include "nvim/arabic.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/cursor_shape.h"
#include "nvim/decoration.h"
#include "nvim/decoration_provider.h"
#include "nvim/diff.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_getln.h"
#include "nvim/extmark.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/garray.h"
#include "nvim/getchar.h"
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
#include "nvim/indent.h"
#include "nvim/lib/kvec.h"
#include "nvim/log.h"
#include "nvim/lua/executor.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/match.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/menu.h"
#include "nvim/message.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/os/time.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/plines.h"
#include "nvim/popupmnu.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/sign.h"
#include "nvim/spell.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/terminal.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/undo.h"
#include "nvim/version.h"
#include "nvim/vim.h"
#include "nvim/window.h"

Data Structures

struct  LineState
 
struct  WinExtmark
 

Macros

#define MB_FILLER_CHAR
 
#define LINE_STATE(p)   { p, 0, 0 }
 
#define DID_NONE   1
 
#define DID_LINE   2
 
#define DID_FOLD   3
 
#define SPWORDLEN   150
 
#define WL_START   0
 
#define WL_CMDLINE   (WL_START + 1)
 
#define WL_FOLD   (WL_CMDLINE + 1)
 
#define WL_SIGN   (WL_FOLD + 1)
 
#define WL_NR   (WL_SIGN + 1)
 
#define WL_BRI   (WL_NR + 1)
 
#define WL_SBR   (WL_BRI + 1)
 
#define WL_LINE   (WL_SBR + 1)
 
#define VCOL_HLC   (vcol - vcol_off)
 
#define FIX_FOR_BOGUSCOLS
 
#define L_MATCH(m)   (showtail ? sm_gettail(matches[m], false) : matches[m])
 
#define RULER_BUF_LEN   70
 

Functions

void redraw_all_later (int type)
 
void screen_invalidate_highlights (void)
 
void redraw_curbuf_later (int type)
 
void redraw_buf_later (buf_T *buf, int type)
 
void redraw_buf_line_later (buf_T *buf, linenr_T line)
 
void redraw_buf_range_later (buf_T *buf, linenr_T firstline, linenr_T lastline)
 
void redrawWinline (win_T *wp, linenr_T lnum) FUNC_ATTR_NONNULL_ALL
 
void update_curbuf (int type)
 
void redraw_buf_status_later (buf_T *buf)
 called when the status bars for the buffer 'buf' need to be updated More...
 
void redraw_win_signcol (win_T *wp)
 
int update_screen (int type)
 
bool conceal_cursor_line (const win_T *wp) FUNC_ATTR_NONNULL_ALL
 
void conceal_check_cursor_line (void)
 
bool win_cursorline_standout (const win_T *wp) FUNC_ATTR_NONNULL_ALL
 
int win_signcol_width (win_T *wp)
 
void draw_virt_text (win_T *wp, buf_T *buf, int col_off, int *end_col, int max_col, int win_row)
 
void rl_mirror (char_u *str)
 
void status_redraw_all (void)
 
void status_redraw_curbuf (void)
 Marks all status lines of the current buffer for redraw. More...
 
void status_redraw_buf (buf_T *buf)
 Marks all status lines of the specified buffer for redraw. More...
 
void redraw_statuslines (void)
 
void win_redraw_last_status (const frame_T *frp) FUNC_ATTR_NONNULL_ARG(1)
 
void win_redr_status_matches (expand_T *xp, int num_matches, char_u **matches, int match, int showtail)
 
bool stl_connected (win_T *wp)
 
bool get_keymap_str (win_T *wp, char_u *fmt, char_u *buf, int len)
 
void check_for_delay (bool check_msg_scroll)
 
void win_grid_alloc (win_T *wp)
 
void grid_assign_handle (ScreenGrid *grid)
 assign a handle to the grid. The grid need not be allocated. More...
 
void screenalloc (void)
 
void clear_tab_page_click_defs (StlClickDefinition *const tpcd, const long tpcd_size)
 
void screenclear (void)
 
void setcursor (void)
 
void win_scroll_lines (win_T *wp, int row, int line_count)
 
void grid_ins_lines (ScreenGrid *grid, int row, int line_count, int end, int col, int width)
 'row', 'col' and 'end' are relative to the start of the region. More...
 
void grid_del_lines (ScreenGrid *grid, int row, int line_count, int end, int col, int width)
 
int showmode (void)
 
void unshowmode (bool force)
 
void clearmode (void)
 
void draw_tabline (void)
 
void ui_ext_tabline_update (void)
 
void get_trans_bufname (buf_T *buf)
 
int fillchar_status (int *attr, win_T *wp)
 
int redrawing (void)
 
int messaging (void)
 
void showruler (bool always)
 
int number_width (win_T *wp)
 
void screen_resize (int width, int height)
 Set dimensions of the Nvim application "shell". More...
 
void check_shellsize (void)
 
void limit_screen_size (void)
 
void win_new_shellsize (void)
 
win_Tget_win_by_grid_handle (handle_T handle)
 

Variables

StlClickDefinitiontab_page_click_defs = NULL
 Array defining what should be done when tabline is clicked. More...
 
long tab_page_click_defs_size = 0
 Size of the tab_page_click_defs array. More...
 

Macro Definition Documentation

◆ DID_FOLD

#define DID_FOLD   3

◆ DID_LINE

#define DID_LINE   2

◆ DID_NONE

#define DID_NONE   1

◆ FIX_FOR_BOGUSCOLS

#define FIX_FOR_BOGUSCOLS
Value:
{ \
n_extra += vcol_off; \
vcol -= vcol_off; \
vcol_off = 0; \
col -= boguscols; \
old_boguscols = boguscols; \
boguscols = 0; \
}

◆ L_MATCH

#define L_MATCH (   m)    (showtail ? sm_gettail(matches[m], false) : matches[m])

◆ LINE_STATE

#define LINE_STATE (   p)    { p, 0, 0 }

◆ MB_FILLER_CHAR

#define MB_FILLER_CHAR
Value:
'<' /* character used when a double-width character
* doesn't fit. */

◆ RULER_BUF_LEN

#define RULER_BUF_LEN   70

◆ SPWORDLEN

#define SPWORDLEN   150

◆ VCOL_HLC

#define VCOL_HLC   (vcol - vcol_off)

◆ WL_BRI

#define WL_BRI   (WL_NR + 1)

◆ WL_CMDLINE

#define WL_CMDLINE   (WL_START + 1)

◆ WL_FOLD

#define WL_FOLD   (WL_CMDLINE + 1)

◆ WL_LINE

#define WL_LINE   (WL_SBR + 1)

◆ WL_NR

#define WL_NR   (WL_SIGN + 1)

◆ WL_SBR

#define WL_SBR   (WL_BRI + 1)

◆ WL_SIGN

#define WL_SIGN   (WL_FOLD + 1)

◆ WL_START

#define WL_START   0

Function Documentation

◆ check_for_delay()

void check_for_delay ( bool  check_msg_scroll)

Check if there should be a delay. Used before clearing or redrawing the screen or the command line.

◆ check_shellsize()

void check_shellsize ( void  )

Check if the new Nvim application "shell" dimensions are valid. Correct it if it's too small or way too big.

◆ clear_tab_page_click_defs()

void clear_tab_page_click_defs ( StlClickDefinition *const  tpcd,
const long  tpcd_size 
)

Clear tab_page_click_defs table

Parameters
[out]tpcdTable to clear.
[in]tpcd_sizeSize of the table.

◆ clearmode()

void clearmode ( void  )

◆ conceal_check_cursor_line()

void conceal_check_cursor_line ( void  )

◆ conceal_cursor_line()

bool conceal_cursor_line ( const win_T wp)

◆ draw_tabline()

void draw_tabline ( void  )

◆ draw_virt_text()

void draw_virt_text ( win_T wp,
buf_T buf,
int  col_off,
int *  end_col,
int  max_col,
int  win_row 
)

◆ fillchar_status()

int fillchar_status ( int *  attr,
win_T wp 
)

◆ get_keymap_str()

bool get_keymap_str ( win_T wp,
char_u fmt,
char_u buf,
int  len 
)

Get the value to show for the language mappings, active 'keymap'.

Parameters
fmtformat string containing one s item
bufbuffer for the result
lenlength of buffer

◆ get_trans_bufname()

void get_trans_bufname ( buf_T buf)

◆ get_win_by_grid_handle()

win_T* get_win_by_grid_handle ( handle_T  handle)

◆ grid_assign_handle()

void grid_assign_handle ( ScreenGrid grid)

assign a handle to the grid. The grid need not be allocated.

◆ grid_del_lines()

void grid_del_lines ( ScreenGrid grid,
int  row,
int  line_count,
int  end,
int  col,
int  width 
)

delete lines on the screen and move lines up. 'end' is the line after the scrolled part. Normally it is Rows. When scrolling region used 'off' is the offset from the top for the region. 'row' and 'end' are relative to the start of the region.

◆ grid_ins_lines()

void grid_ins_lines ( ScreenGrid grid,
int  row,
int  line_count,
int  end,
int  col,
int  width 
)

'row', 'col' and 'end' are relative to the start of the region.

insert lines on the screen and move the existing lines down 'line_count' is the number of lines to be inserted. 'end' is the line after the scrolled part. Normally it is Rows. 'col' is the column from with we start inserting.

◆ limit_screen_size()

void limit_screen_size ( void  )

◆ messaging()

int messaging ( void  )

◆ number_width()

int number_width ( win_T wp)

◆ redraw_all_later()

void redraw_all_later ( int  type)

◆ redraw_buf_later()

void redraw_buf_later ( buf_T buf,
int  type 
)

◆ redraw_buf_line_later()

void redraw_buf_line_later ( buf_T buf,
linenr_T  line 
)

◆ redraw_buf_range_later()

void redraw_buf_range_later ( buf_T buf,
linenr_T  firstline,
linenr_T  lastline 
)

◆ redraw_buf_status_later()

void redraw_buf_status_later ( buf_T buf)

called when the status bars for the buffer 'buf' need to be updated

◆ redraw_curbuf_later()

void redraw_curbuf_later ( int  type)

◆ redraw_statuslines()

void redraw_statuslines ( void  )

◆ redraw_win_signcol()

void redraw_win_signcol ( win_T wp)

◆ redrawing()

int redrawing ( void  )

◆ redrawWinline()

void redrawWinline ( win_T wp,
linenr_T  lnum 
)

◆ rl_mirror()

void rl_mirror ( char_u str)

◆ screen_invalidate_highlights()

void screen_invalidate_highlights ( void  )

◆ screen_resize()

void screen_resize ( int  width,
int  height 
)

Set dimensions of the Nvim application "shell".

◆ screenalloc()

void screenalloc ( void  )

Resize the screen to Rows and Columns.

Allocate default_grid.chars[] and other grid arrays.

There may be some time between setting Rows and Columns and (re)allocating default_grid arrays. This happens when starting up and when (manually) changing the shell size. Always use default_grid.Rows and default_grid.Columns to access items in default_grid.chars[]. Use Rows and Columns for positioning text etc. where the final size of the shell is needed.

◆ screenclear()

void screenclear ( void  )

◆ setcursor()

void setcursor ( void  )

◆ showmode()

int showmode ( void  )

◆ showruler()

void showruler ( bool  always)

Show current status info in ruler and various other places

Parameters
alwaysif false, only show ruler if position has changed.

◆ status_redraw_all()

void status_redraw_all ( void  )

◆ status_redraw_buf()

void status_redraw_buf ( buf_T buf)

Marks all status lines of the specified buffer for redraw.

◆ status_redraw_curbuf()

void status_redraw_curbuf ( void  )

Marks all status lines of the current buffer for redraw.

◆ stl_connected()

bool stl_connected ( win_T wp)

Only call if (wp->w_vsep_width != 0).

Returns
true if the status line of window "wp" is connected to the status line of the window right of it. If not, then it's a vertical separator.

◆ ui_ext_tabline_update()

void ui_ext_tabline_update ( void  )

◆ unshowmode()

void unshowmode ( bool  force)

Delete mode message. Used when ESC is typed which is expected to end Insert mode (but Insert mode didn't end yet!). Caller should check "mode_displayed".

◆ update_curbuf()

void update_curbuf ( int  type)

◆ update_screen()

int update_screen ( int  type)

Redraw the parts of the screen that is marked for redraw.

Most code shouldn't call this directly, rather use redraw_later() and and redraw_all_later() to mark parts of the screen as needing a redraw.

Parameters
typeset to a NOT_VALID to force redraw of entire screen

◆ win_cursorline_standout()

bool win_cursorline_standout ( const win_T wp)

Whether cursorline is drawn in a special way

If true, both old and new cursorline will need to be redrawn when moving cursor within windows.

◆ win_grid_alloc()

void win_grid_alloc ( win_T wp)

(Re)allocates a window grid if size changed while in ext_multigrid mode. Updates size, offsets and handle for the grid regardless.

If "doclear" is true, don't try to copy from the old grid rather clear the resized grid.

◆ win_new_shellsize()

void win_new_shellsize ( void  )

◆ win_redr_status_matches()

void win_redr_status_matches ( expand_T xp,
int  num_matches,
char_u **  matches,
int  match,
int  showtail 
)

Show wildchar matches in the status line. Show at least the "match" item. We start at item 'first_match' in the list and show all matches that fit.

If inversion is possible we use it. Else '=' characters are used.

Parameters
matcheslist of matches

◆ win_redraw_last_status()

void win_redraw_last_status ( const frame_T frp)

◆ win_scroll_lines()

void win_scroll_lines ( win_T wp,
int  row,
int  line_count 
)

Scroll 'line_count' lines at 'row' in window 'wp'.

Positive ‘line_count’ means scrolling down, so that more space is available at 'row'. Negative line_count implies deleting lines at row.

◆ win_signcol_width()

int win_signcol_width ( win_T wp)

Returns width of the signcolumn that should be used for the whole window

Parameters
wpwindow we want signcolumn width from
Returns
max width of signcolumn (cell unit)
Note
Returns a constant for now but hopefully we can improve neovim so that the returned value width adapts to the maximum number of marks to draw for the window TODO(teto)

Variable Documentation

◆ tab_page_click_defs

StlClickDefinition* tab_page_click_defs = NULL

Array defining what should be done when tabline is clicked.

◆ tab_page_click_defs_size

long tab_page_click_defs_size = 0

Size of the tab_page_click_defs array.