diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2016-06-19 21:06:03 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2016-08-31 21:40:20 +0200 |
commit | a2d25b7bf81728d913e7b317d33997c8b8268af2 (patch) | |
tree | 35a9a81aa16a7e0756a8d438207c7af0b53478b3 /src/nvim/buffer_defs.h | |
parent | 3bd3b3b76859b3eef80fa4969147efa881b60f40 (diff) | |
download | rneovim-a2d25b7bf81728d913e7b317d33997c8b8268af2.tar.gz rneovim-a2d25b7bf81728d913e7b317d33997c8b8268af2.tar.bz2 rneovim-a2d25b7bf81728d913e7b317d33997c8b8268af2.zip |
api: unify buffer numbers and window ids with handles
also allow handle==0 meaning curbuf/curwin/curtab
Diffstat (limited to 'src/nvim/buffer_defs.h')
-rw-r--r-- | src/nvim/buffer_defs.h | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 46687f344c..ab5987612c 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -461,9 +461,10 @@ typedef struct { */ struct file_buffer { - uint64_t handle; // unique identifier for the buffer - memline_T b_ml; /* associated memline (also contains line - count) */ + handle_T handle; // unique id for the buffer (buffer number) +#define b_fnum handle + + memline_T b_ml; // associated memline (also contains line count buf_T *b_next; /* links in list of buffers */ buf_T *b_prev; @@ -487,8 +488,6 @@ struct file_buffer { bool file_id_valid; FileID file_id; - int b_fnum; /* buffer number for this file. */ - bool b_changed; /* 'modified': Set to true if something in the file has been changed and not written out. */ int b_changedtick; /* incremented for each change, also for undo */ @@ -799,28 +798,27 @@ struct diffblock_S { # define SNAP_AUCMD_IDX 1 # define SNAP_COUNT 2 -/* - * Tab pages point to the top frame of each tab page. - * Note: Most values are NOT valid for the current tab page! Use "curwin", - * "firstwin", etc. for that. "tp_topframe" is always valid and can be - * compared against "topframe" to find the current tab page. - */ +/// Tab pages point to the top frame of each tab page. +/// Note: Most values are NOT valid for the current tab page! Use "curwin", +/// "firstwin", etc. for that. "tp_topframe" is always valid and can be +/// compared against "topframe" to find the current tab page. typedef struct tabpage_S tabpage_T; struct tabpage_S { - uint64_t handle; - tabpage_T *tp_next; /* next tabpage or NULL */ - frame_T *tp_topframe; /* topframe for the windows */ - win_T *tp_curwin; /* current window in this Tab page */ - win_T *tp_prevwin; /* previous window in this Tab page */ - win_T *tp_firstwin; /* first window in this Tab page */ - win_T *tp_lastwin; /* last window in this Tab page */ - long tp_old_Rows; /* Rows when Tab page was left */ - long tp_old_Columns; /* Columns when Tab page was left */ - long tp_ch_used; /* value of 'cmdheight' when frame size - was set */ + handle_T handle; + tabpage_T *tp_next; ///< next tabpage or NULL + frame_T *tp_topframe; ///< topframe for the windows + win_T *tp_curwin; ///< current window in this Tab page + win_T *tp_prevwin; ///< previous window in this Tab page + win_T *tp_firstwin; ///< first window in this Tab page + win_T *tp_lastwin; ///< last window in this Tab page + long tp_old_Rows; ///< Rows when Tab page was left + long tp_old_Columns; ///< Columns when Tab page was left + long tp_ch_used; ///< value of 'cmdheight' when frame size + ///< was set + diff_T *tp_first_diff; buf_T *(tp_diffbuf[DB_COUNT]); - int tp_diff_invalid; ///< list of diffs is outdated */ + int tp_diff_invalid; ///< list of diffs is outdated frame_T *(tp_snapshot[SNAP_COUNT]); ///< window layout snapshots dictitem_T tp_winvar; ///< variable for "t:" Dictionary dict_T *tp_vars; ///< internal variables, local to tab page @@ -936,8 +934,8 @@ struct matchitem { * All row numbers are relative to the start of the window, except w_winrow. */ struct window_S { - uint64_t handle; - int w_id; ///< unique window ID + handle_T handle; ///< unique identifier for the window + buf_T *w_buffer; ///< buffer we are a window into (used ///< often, keep it the first item!) |