Macros | Functions
window.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include "nvim/api/private/handle.h"
#include "nvim/api/private/helpers.h"
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/window.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cursor.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_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/file_search.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/mouse.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/terminal.h"
#include "nvim/undo.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/os/os.h"


#define NOWIN   (win_T *)-1 /* non-existing window */
#define ROWS_AVAIL   (Rows - p_ch - tabline_height())
#define CHECK_CMDWIN   if (cmdwin_type != 0) { EMSG(_(e_cmdwin)); break; }
#define FRACTION_MULT   16384L


void do_window (int nchar, long Prenum, int xchar)
win_Twin_new_float (win_T *wp, FloatConfig fconfig, Error *err)
void win_config_float (win_T *wp, FloatConfig fconfig)
bool parse_float_config (Dictionary config, FloatConfig *fconfig, bool reconf, Error *err)
int win_split (int size, int flags)
int win_split_ins (int size, int flags, win_T *new_wp, int dir)
bool win_valid_any_tab (win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
int win_count (void)
int make_windows (int count, int vertical)
void win_move_after (win_T *win1, win_T *win2)
void win_equal (win_T *next_curwin, bool current, int dir)
void close_windows (buf_T *buf, int keep_curwin)
bool one_window (void)
bool one_nonfloat (void)
 Like ONE_WINDOW but only considers non-floating windows. More...
bool last_nonfloat (win_T *wp) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
int win_close (win_T *win, bool free_buf)
void win_close_othertab (win_T *win, int free_buf, tabpage_T *tp)
win_Twinframe_remove (win_T *win, int *dirp, tabpage_T *tp)
void close_others (int message, int forceit)
void curwin_init (void)
void win_init_empty (win_T *wp)
int win_alloc_first (void)
void win_alloc_aucmd_win (void)
void win_init_size (void)
void free_tabpage (tabpage_T *tp)
int win_new_tabpage (int after, char_u *filename)
int may_open_tabpage (void)
int make_tabpages (int maxcount)
bool valid_tabpage (tabpage_T *tpc) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
int valid_tabpage_win (tabpage_T *tpc)
 Returns true when tpc is valid and at least one window is valid. More...
void close_tabpage (tabpage_T *tab)
tabpage_Tfind_tabpage (int n)
int tabpage_index (tabpage_T *ftp)
void goto_tabpage (int n)
void goto_tabpage_tp (tabpage_T *tp, int trigger_enter_autocmds, int trigger_leave_autocmds)
void goto_tabpage_win (tabpage_T *tp, win_T *wp)
void tabpage_move (int nr)
void win_goto (win_T *wp)
tabpage_Twin_find_tabpage (win_T *win)
void win_enter (win_T *wp, bool undo_sync)
win_Tbuf_jump_open_win (buf_T *buf)
win_Tbuf_jump_open_tab (buf_T *buf)
void win_free_grid (win_T *wp, bool reinit)
void win_append (win_T *after, win_T *wp)
void win_remove (win_T *wp, tabpage_T *tp)
void shell_new_rows (void)
void shell_new_columns (void)
void win_size_save (garray_T *gap)
void win_size_restore (garray_T *gap)
int win_comp_pos (void)
void win_setheight (int height)
void win_setheight_win (int height, win_T *win)
void win_setwidth (int width)
void win_setwidth_win (int width, win_T *wp)
void win_setminheight (void)
void win_drag_status_line (win_T *dragwin, int offset)
void win_drag_vsep_line (win_T *dragwin, int offset)
void set_fraction (win_T *wp)
void win_new_height (win_T *wp, int height)
void scroll_to_fraction (win_T *wp, int prev_height)
void win_set_inner_size (win_T *wp)
void win_new_width (win_T *wp, int width)
 Set the width of a window. More...
void win_comp_scroll (win_T *wp)
void command_height (void)
char_ugrab_file_name (long count, linenr_T *file_lnum)
char_ufile_name_at_cursor (int options, long count, linenr_T *file_lnum)
char_ufile_name_in_line (char_u *line, int col, int options, long count, char_u *rel_fname, linenr_T *file_lnum)
void last_status (int morewin)
int tabline_height (void)
int min_rows (void)
bool only_one_window (void)
void check_lnums (int do_curwin)
void make_snapshot (int idx)
void restore_snapshot (int idx, int close_curwin)
int switch_win (win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display)
void restore_win (win_T *save_curwin, tabpage_T *save_curtab, bool no_display)
void switch_buffer (bufref_T *save_curbuf, buf_T *buf)
void restore_buffer (bufref_T *save_curbuf)
 Restore the current buffer after using switch_buffer(). More...
int match_add (win_T *wp, const char *const grp, const char *const pat, int prio, int id, list_T *pos_list, const char *const conceal_char)
int match_delete (win_T *wp, int id, int perr)
void clear_matches (win_T *wp)
matchitem_Tget_match (win_T *wp, int id)
int win_getid (typval_T *argvars)
int win_gotoid (typval_T *argvars)
void win_get_tabwin (handle_T id, int *tabnr, int *winnr)
void win_id2tabwin (typval_T *const argvars, typval_T *const rettv)
win_Twin_id2wp (typval_T *argvars)
int win_id2win (typval_T *argvars)
void win_findbuf (typval_T *argvars, list_T *list)
void win_ui_flush_positions (void)
win_Tlastwin_nofloating (void)

Macro Definition Documentation

#define CHECK_CMDWIN   if (cmdwin_type != 0) { EMSG(_(e_cmdwin)); break; }
#define FRACTION_MULT   16384L
#define NOWIN   (win_T *)-1 /* non-existing window */
#define ROWS_AVAIL   (Rows - p_ch - tabline_height())

Function Documentation

win_T* buf_jump_open_tab ( buf_T buf)

Jump to the first open window in any tab page that contains buffer "buf", if one exists.

the found window, or NULL.
win_T* buf_jump_open_win ( buf_T buf)

Jump to the first open window that contains buffer "buf", if one exists. Returns a pointer to the window found, otherwise NULL.

void check_lnums ( int  do_curwin)
void clear_matches ( win_T wp)
void close_others ( int  message,
int  forceit 
void close_tabpage ( tabpage_T tab)

Close tabpage tab, assuming it has no windows in it. There must be another tabpage or this will crash.

void close_windows ( buf_T buf,
int  keep_curwin 

Closes all windows for buffer buf.

keep_curwindon't close curwin
void command_height ( void  )
void curwin_init ( void  )
void do_window ( int  nchar,
long  Prenum,
int  xchar 
char_u* file_name_at_cursor ( int  options,
long  count,
linenr_T file_lnum 
char_u* file_name_in_line ( char_u line,
int  col,
int  options,
long  count,
char_u rel_fname,
linenr_T file_lnum 
tabpage_T* find_tabpage ( int  n)
void free_tabpage ( tabpage_T tp)
matchitem_T* get_match ( win_T wp,
int  id 
void goto_tabpage ( int  n)
void goto_tabpage_tp ( tabpage_T tp,
int  trigger_enter_autocmds,
int  trigger_leave_autocmds 
void goto_tabpage_win ( tabpage_T tp,
win_T wp 
char_u* grab_file_name ( long  count,
linenr_T file_lnum 
bool last_nonfloat ( win_T wp)

if wp is the last non-floating window

always false for a floating window

void last_status ( int  morewin)
win_T* lastwin_nofloating ( void  )
void make_snapshot ( int  idx)
int make_tabpages ( int  maxcount)
int make_windows ( int  count,
int  vertical 
int match_add ( win_T wp,
const char *const  grp,
const char *const  pat,
int  prio,
int  id,
list_T pos_list,
const char *const  conceal_char 

Add match to the match list of window 'wp'. The pattern 'pat' will be highlighted with the group 'grp' with priority 'prio'. Optionally, a desired ID 'id' can be specified (greater than or equal to 1).

[in]ida desired ID 'id' can be specified (greater than or equal to 1). -1 must be specified if no particular ID is desired
ID of added match, -1 on failure.
int match_delete ( win_T wp,
int  id,
int  perr 

Delete match with ID 'id' in the match list of window 'wp'. Print error messages if 'perr' is TRUE.

int may_open_tabpage ( void  )
int min_rows ( void  )
bool one_nonfloat ( void  )

Like ONE_WINDOW but only considers non-floating windows.

bool one_window ( void  )

Check that current tab page contains no more then one window other than "aucmd_win". Only counts floating window if it is current.

bool only_one_window ( void  )

Check that there is only one window (and only one tab page), not counting a help or preview window, unless it is the current window. Does not count "aucmd_win". Does not count floats unless it is current.

bool parse_float_config ( Dictionary  config,
FloatConfig fconfig,
bool  reconf,
Error err 
void restore_buffer ( bufref_T save_curbuf)

Restore the current buffer after using switch_buffer().

void restore_snapshot ( int  idx,
int  close_curwin 
void restore_win ( win_T save_curwin,
tabpage_T save_curtab,
bool  no_display 
void scroll_to_fraction ( win_T wp,
int  prev_height 
void set_fraction ( win_T wp)
void shell_new_columns ( void  )
void shell_new_rows ( void  )
void switch_buffer ( bufref_T save_curbuf,
buf_T buf 

Make "buf" the current buffer.

restore_buffer() MUST be called to undo. No autocommands will be executed. Use aucmd_prepbuf() if there are any.

int switch_win ( win_T **  save_curwin,
tabpage_T **  save_curtab,
win_T win,
tabpage_T tp,
int  no_display 
int tabline_height ( void  )
int tabpage_index ( tabpage_T ftp)
void tabpage_move ( int  nr)
bool valid_tabpage ( tabpage_T tpc)

Check that tpc points to a valid tab page.

[in]tpcTabpage to check.
int valid_tabpage_win ( tabpage_T tpc)

Returns true when tpc is valid and at least one window is valid.

void win_alloc_aucmd_win ( void  )
int win_alloc_first ( void  )
void win_append ( win_T after,
win_T wp 
int win_close ( win_T win,
bool  free_buf 
void win_close_othertab ( win_T win,
int  free_buf,
tabpage_T tp 
int win_comp_pos ( void  )
void win_comp_scroll ( win_T wp)
void win_config_float ( win_T wp,
FloatConfig  fconfig 
int win_count ( void  )
void win_drag_status_line ( win_T dragwin,
int  offset 
void win_drag_vsep_line ( win_T dragwin,
int  offset 
void win_enter ( win_T wp,
bool  undo_sync 
void win_equal ( win_T next_curwin,
bool  current,
int  dir 
tabpage_T* win_find_tabpage ( win_T win)
void win_findbuf ( typval_T argvars,
list_T list 
void win_free_grid ( win_T wp,
bool  reinit 
void win_get_tabwin ( handle_T  id,
int *  tabnr,
int *  winnr 
int win_getid ( typval_T argvars)
void win_goto ( win_T wp)
int win_gotoid ( typval_T argvars)
void win_id2tabwin ( typval_T *const  argvars,
typval_T *const  rettv 
int win_id2win ( typval_T argvars)
win_T* win_id2wp ( typval_T argvars)
void win_init_empty ( win_T wp)
void win_init_size ( void  )
void win_move_after ( win_T win1,
win_T win2 
win_T* win_new_float ( win_T wp,
FloatConfig  fconfig,
Error err 

Create a new float.

if wp == NULL allocate a new window, otherwise turn existing window into a float. It must then already belong to the current tabpage!

config must already have been validated!

void win_new_height ( win_T wp,
int  height 
int win_new_tabpage ( int  after,
char_u filename 

Create a new tabpage with one window.

It will edit the current buffer, like after :split.

afterPut new tabpage after tabpage "after", or after the current tabpage in case of 0.
filenameWill be passed to apply_autocmds().
Was the new tabpage created successfully? FAIL or OK.
void win_new_width ( win_T wp,
int  width 

Set the width of a window.

void win_remove ( win_T wp,
tabpage_T tp 
void win_set_inner_size ( win_T wp)
void win_setheight ( int  height)
void win_setheight_win ( int  height,
win_T win 
void win_setminheight ( void  )
void win_setwidth ( int  width)
void win_setwidth_win ( int  width,
win_T wp 
void win_size_restore ( garray_T gap)
void win_size_save ( garray_T gap)
int win_split ( int  size,
int  flags 
int win_split_ins ( int  size,
int  flags,
win_T new_wp,
int  dir 
void win_ui_flush_positions ( void  )
bool win_valid ( win_T win)

Check if "win" is a pointer to an existing window in the current tabpage.

winwindow to check
bool win_valid_any_tab ( win_T win)

Check if "win" is a pointer to an existing window in any tabpage.

winwindow to check
win_T* winframe_remove ( win_T win,
int *  dirp,
tabpage_T tp