window_S is the structure that contains all information that belongs to a window.
All row numbers are relative to the start of the window, except w_winrow.
typedef struct window_S win_T;
struct window_S
{
int w_id; // unique window ID
buf_T *w_buffer; // buffer we are a window into
win_T *w_prev; // link to previous window
win_T *w_next; // link to next window
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
synblock_T *w_s; // for :ownsyntax
#endif
int w_closing; // window is being closed, don't let
// autocommands close it too.
frame_T *w_frame; // frame containing this window
pos_T w_cursor; // cursor position in buffer
colnr_T w_curswant; // The column we'd like to be at. This is
// used to try to stay in the same column
// for up/down cursor motions.
int w_set_curswant; // If set, then update w_curswant the next
// time through cursupdate() to the
// current virtual column
#ifdef FEAT_SYN_HL
linenr_T w_last_cursorline; // where last time 'cursorline' was drawn
#endif
/*
* the next seven are used to update the Visual highlighting
*/
char w_old_visual_mode; // last known VIsual_mode
linenr_T w_old_cursor_lnum; // last known end of visual part
colnr_T w_old_cursor_fcol; // first column for block visual part
colnr_T w_old_cursor_lcol; // last column for block visual part
linenr_T w_old_visual_lnum; // last known start of visual part
colnr_T w_old_visual_col; // last known start of visual part
colnr_T w_old_curswant; // last known value of Curswant
/*
* "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
* displaying the buffer.
*/
linenr_T w_topline; // buffer line number of the line at the
// top of the window
char w_topline_was_set; // flag set to TRUE when topline is set,
// e.g. by winrestview()
#ifdef FEAT_DIFF
int w_topfill; // number of filler lines above w_topline
int w_old_topfill; // w_topfill at last redraw
int w_botfill; // TRUE when filler lines are actually
// below w_topline (at end of file)
int w_old_botfill; // w_botfill at last redraw
#endif
colnr_T w_leftcol; // window column number of the left most
// character in the window; used when
// 'wrap' is off
colnr_T w_skipcol; // starting column when a single line
// doesn't fit in the window
/*
* Layout of the window in the screen.
* May need to add "msg_scrolled" to "w_winrow" in rare situations.
*/
int w_winrow; // first row of window in screen
int w_height; // number of rows in window, excluding
// status/command/winbar line(s)
int w_status_height; // number of status lines (0 or 1)
int w_wincol; // Leftmost column of window in screen.
int w_width; // Width of window, excluding separation.
int w_vsep_width; // Number of separator columns (0 or 1).
pos_save_T w_save_cursor; // backup of cursor pos and topline
#ifdef FEAT_PROP_POPUP
int w_popup_flags; // POPF_ values
int w_popup_handled; // POPUP_HANDLE[0-9] flags
char_u *w_popup_title;
poppos_T w_popup_pos;
int w_popup_fixed; // do not shift popup to fit on screen
int w_popup_prop_type; // when not zero: textprop type ID
win_T *w_popup_prop_win; // window to search for textprop
int w_popup_prop_id; // when not zero: textprop ID
int w_zindex;
int w_minheight; // "minheight" for popup window
int w_minwidth; // "minwidth" for popup window
int w_maxheight; // "maxheight" for popup window
int w_maxwidth; // "maxwidth" for popup window
int w_wantline; // "line" for popup window
int w_wantcol; // "col" for popup window
int w_firstline; // "firstline" for popup window
int w_want_scrollbar; // when zero don't use a scrollbar
int w_has_scrollbar; // 1 if scrollbar displayed, 0 otherwise
char_u *w_scrollbar_highlight; // "scrollbarhighlight"
char_u *w_thumb_highlight; // "thumbhighlight"
int w_popup_padding[4]; // popup padding top/right/bot/left
int w_popup_border[4]; // popup border top/right/bot/left
char_u *w_border_highlight[4]; // popup border highlight
int w_border_char[8]; // popup border characters
int w_popup_leftoff; // columns left of the screen
int w_popup_rightoff; // columns right of the screen
varnumber_T w_popup_last_changedtick; // b:changedtick of popup buffer
// when position was computed
varnumber_T w_popup_prop_changedtick; // b:changedtick of buffer with
// w_popup_prop_type when position
// was computed
int w_popup_prop_topline; // w_topline of window with
// w_popup_prop_type when position was
// computed
linenr_T w_popup_last_curline; // last known w_cursor.lnum of window
// with "cursorline" set
callback_T w_close_cb; // popup close callback
callback_T w_filter_cb; // popup filter callback
int w_filter_mode; // mode when filter callback is used
win_T *w_popup_curwin; // close popup if curwin differs
linenr_T w_popup_lnum; // close popup if cursor not on this line
colnr_T w_popup_mincol; // close popup if cursor before this col
colnr_T w_popup_maxcol; // close popup if cursor after this col
int w_popup_mouse_row; // close popup if mouse moves away
int w_popup_mouse_mincol; // close popup if mouse moves away
int w_popup_mouse_maxcol; // close popup if mouse moves away
popclose_T w_popup_close; // allow closing the popup with the mouse
list_T *w_popup_mask; // list of lists for "mask"
char_u *w_popup_mask_cells; // cached mask cells
int w_popup_mask_height; // height of w_popup_mask_cells
int w_popup_mask_width; // width of w_popup_mask_cells
# if defined(FEAT_TIMERS)
timer_T *w_popup_timer; // timer for closing popup window
# endif
#endif
/*
* === start of cached values ====
*/
/*
* Recomputing is minimized by storing the result of computations.
* Use functions in screen.c to check if they are valid and to update.
* w_valid is a bitfield of flags, which indicate if specific values are
* valid or need to be recomputed. See screen.c for values.
*/
int w_valid;
pos_T w_valid_cursor; // last known position of w_cursor, used
// to adjust w_valid
colnr_T w_valid_leftcol; // last known w_leftcol
/*
* w_cline_height is the number of physical lines taken by the buffer line
* that the cursor is on. We use this to avoid extra calls to plines().
*/
int w_cline_height; // current size of cursor line
#ifdef FEAT_FOLDING
int w_cline_folded; // cursor line is folded
#endif
int w_cline_row; // starting row of the cursor line
colnr_T w_virtcol; // column number of the cursor in the
// buffer line, as opposed to the column
// number we're at on the screen. This
// makes a difference on lines which span
// more than one screen line or when
// w_leftcol is non-zero
/*
* w_wrow and w_wcol specify the cursor position in the window.
* This is related to positions in the window, not in the display or
* buffer, thus w_wrow is relative to w_winrow.
*/
int w_wrow, w_wcol; // cursor position in window
linenr_T w_botline; // number of the line below the bottom of
// the window
int w_empty_rows; // number of ~ rows in window
#ifdef FEAT_DIFF
int w_filler_rows; // number of filler rows at the end of the
// window
#endif
/*
* Info about the lines currently in the window is remembered to avoid
* recomputing it every time. The allocated size of w_lines[] is Rows.
* Only the w_lines_valid entries are actually valid.
* When the display is up-to-date w_lines[0].wl_lnum is equal to w_topline
* and w_lines[w_lines_valid - 1].wl_lnum is equal to w_botline.
* Between changing text and updating the display w_lines[] represents
* what is currently displayed. wl_valid is reset to indicated this.
* This is used for efficient redrawing.
*/
int w_lines_valid; // number of valid entries
wline_T *w_lines;
#ifdef FEAT_FOLDING
garray_T w_folds; // array of nested folds
char w_fold_manual; // when TRUE: some folds are opened/closed
// manually
char w_foldinvalid; // when TRUE: folding needs to be
// recomputed
#endif
#ifdef FEAT_LINEBREAK
int w_nrwidth; // width of 'number' and 'relativenumber'
// column being used
#endif
/*
* === end of cached values ===
*/
int w_redr_type; // type of redraw to be performed on win
int w_upd_rows; // number of window lines to update when
// w_redr_type is REDRAW_TOP
linenr_T w_redraw_top; // when != 0: first line needing redraw
linenr_T w_redraw_bot; // when != 0: last line needing redraw
int w_redr_status; // if TRUE status line must be redrawn
#ifdef FEAT_CMDL_INFO
// remember what is shown in the ruler for this window (if 'ruler' set)
pos_T w_ru_cursor; // cursor position shown in ruler
colnr_T w_ru_virtcol; // virtcol shown in ruler
linenr_T w_ru_topline; // topline shown in ruler
linenr_T w_ru_line_count; // line count used for ruler
# ifdef FEAT_DIFF
int w_ru_topfill; // topfill shown in ruler
# endif
char w_ru_empty; // TRUE if ruler shows 0-1 (empty line)
#endif
int w_alt_fnum; // alternate file (for # and CTRL-^)
alist_T *w_alist; // pointer to arglist for this window
int w_arg_idx; // current index in argument list (can be
// out of range!)
int w_arg_idx_invalid; // editing another file than w_arg_idx
char_u *w_localdir; // absolute path of local directory or
// NULL
#ifdef FEAT_MENU
vimmenu_T *w_winbar; // The root of the WinBar menu hierarchy.
winbar_item_T *w_winbar_items; // list of items in the WinBar
int w_winbar_height; // 1 if there is a window toolbar
#endif
/*
* Options local to a window.
* They are local because they influence the layout of the window or
* depend on the window layout.
* There are two values: w_onebuf_opt is local to the buffer currently in
* this window, w_allbuf_opt is for all buffers in this window.
*/
winopt_T w_onebuf_opt;
winopt_T w_allbuf_opt;
// A few options have local flags for P_INSECURE.
#ifdef FEAT_STL_OPT
long_u w_p_stl_flags; // flags for 'statusline'
#endif
#ifdef FEAT_EVAL
long_u w_p_fde_flags; // flags for 'foldexpr'
long_u w_p_fdt_flags; // flags for 'foldtext'
#endif
#ifdef FEAT_SYN_HL
int *w_p_cc_cols; // array of columns to highlight or NULL
char_u w_p_culopt_flags; // flags for cursorline highlighting
#endif
#ifdef FEAT_LINEBREAK
int w_p_brimin; // minimum width for breakindent
int w_p_brishift; // additional shift for breakindent
int w_p_brisbr; // sbr in 'briopt'
#endif
long w_p_siso; // 'sidescrolloff' local value
long w_p_so; // 'scrolloff' local value
// transform a pointer to a "onebuf" option into a "allbuf" option
#define GLOBAL_WO(p) ((char *)p + sizeof(winopt_T))
long w_scbind_pos;
#ifdef FEAT_EVAL
dictitem_T w_winvar; // variable for "w:" Dictionary
dict_T *w_vars; // internal variables, local to window
#endif
/*
* The w_prev_pcmark field is used to check whether we really did jump to
* a new line after setting the w_pcmark. If not, then we revert to
* using the previous w_pcmark.
*/
pos_T w_pcmark; // previous context mark
pos_T w_prev_pcmark; // previous w_pcmark
#ifdef FEAT_JUMPLIST
/*
* the jumplist contains old cursor positions
*/
xfmark_T w_jumplist[JUMPLISTSIZE];
int w_jumplistlen; // number of active entries
int w_jumplistidx; // current position
int w_changelistidx; // current position in b_changelist
#endif
#ifdef FEAT_SEARCH_EXTRA
matchitem_T *w_match_head; // head of match list
int w_next_match_id; // next match ID
#endif
/*
* the tagstack grows from 0 upwards:
* entry 0: older
* entry 1: newer
* entry 2: newest
*/
taggy_T w_tagstack[TAGSTACKSIZE]; // the tag stack
int w_tagstackidx; // idx just below active entry
int w_tagstacklen; // number of tags on stack
/*
* w_fraction is the fractional row of the cursor within the window, from
* 0 at the top row to FRACTION_MULT at the last row.
* w_prev_fraction_row was the actual cursor row when w_fraction was last
* calculated.
*/
int w_fraction;
int w_prev_fraction_row;
#ifdef FEAT_GUI
scrollbar_T w_scrollbars[2]; // vert. Scrollbars for this window
#endif
#ifdef FEAT_LINEBREAK
linenr_T w_nrwidth_line_count; // line count when ml_nrwidth_width
// was computed.
long w_nuw_cached; // 'numberwidth' option cached
int w_nrwidth_width; // nr of chars to print line count.
#endif
#ifdef FEAT_QUICKFIX
qf_info_T *w_llist; // Location list for this window
/*
* Location list reference used in the location list window.
* In a non-location list window, w_llist_ref is NULL.
*/
qf_info_T *w_llist_ref;
#endif
#ifdef FEAT_MZSCHEME
void *w_mzscheme_ref; // The MzScheme value for this window
#endif
#ifdef FEAT_PERL
void *w_perl_private;
#endif
#ifdef FEAT_PYTHON
void *w_python_ref; // The Python value for this window
#endif
#ifdef FEAT_PYTHON3
void *w_python3_ref; // The Python value for this window
#endif
#ifdef FEAT_TCL
void *w_tcl_ref;
#endif
#ifdef FEAT_RUBY
void *w_ruby_ref;
#endif
};