Merge #9306 'vim-patch: integrate xdiff library'

closes #1466
closes #1007
closes #1391
This commit is contained in:
Justin M. Keyes
2018-12-09 23:00:03 +01:00
30 changed files with 6023 additions and 314 deletions

View File

@@ -58,10 +58,10 @@ typedef struct {
* functions that set or reset the flags.
*
* VALID_BOTLINE VALID_BOTLINE_AP
* on on w_botline valid
* off on w_botline approximated
* off off w_botline not valid
* on off not possible
* on on w_botline valid
* off on w_botline approximated
* off off w_botline not valid
* on off not possible
*/
#define VALID_WROW 0x01 /* w_wrow (window row) is valid */
#define VALID_WCOL 0x02 /* w_wcol (window col) is valid */
@@ -159,7 +159,7 @@ typedef struct {
int wo_arab;
# define w_p_arab w_onebuf_opt.wo_arab /* 'arabic' */
int wo_bri;
# define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */
# define w_p_bri w_onebuf_opt.wo_bri // 'breakindent'
char_u *wo_briopt;
# define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */
int wo_diff;
@@ -412,13 +412,13 @@ typedef struct {
* syntax state too often.
* b_sst_array[] is allocated to hold the state for all displayed lines,
* and states for 1 out of about 20 other lines.
* b_sst_array pointer to an array of synstate_T
* b_sst_len number of entries in b_sst_array[]
* b_sst_first pointer to first used entry in b_sst_array[] or NULL
* b_sst_firstfree pointer to first free entry in b_sst_array[] or NULL
* b_sst_freecount number of free entries in b_sst_array[]
* b_sst_check_lnum entries after this lnum need to be checked for
* validity (MAXLNUM means no check needed)
* b_sst_array pointer to an array of synstate_T
* b_sst_len number of entries in b_sst_array[]
* b_sst_first pointer to first used entry in b_sst_array[] or NULL
* b_sst_firstfree pointer to first free entry in b_sst_array[] or NULL
* b_sst_freecount number of free entries in b_sst_array[]
* b_sst_check_lnum entries after this lnum need to be checked for
* validity (MAXLNUM means no check needed)
*/
synstate_T *b_sst_array;
int b_sst_len;
@@ -475,15 +475,15 @@ struct file_buffer {
int b_locked; // Buffer is being closed or referenced, don't
// let autocommands wipe it out.
/*
* b_ffname has the full path of the file (NULL for no name).
* b_sfname is the name as the user typed it (or NULL).
* b_fname is the same as b_sfname, unless ":cd" has been done,
* then it is the same as b_ffname (NULL for no name).
*/
char_u *b_ffname; /* full path file name */
char_u *b_sfname; /* short file name */
char_u *b_fname; /* current file name */
//
// b_ffname has the full path of the file (NULL for no name).
// b_sfname is the name as the user typed it (or NULL).
// b_fname is the same as b_sfname, unless ":cd" has been done,
// then it is the same as b_ffname (NULL for no name).
//
char_u *b_ffname; // full path file name
char_u *b_sfname; // short file name
char_u *b_fname; // current file name
bool file_id_valid;
FileID file_id;
@@ -587,12 +587,12 @@ struct file_buffer {
bool b_scanned; /* ^N/^P have scanned this buffer */
/* flags for use of ":lmap" and IM control */
long b_p_iminsert; /* input mode for insert */
long b_p_imsearch; /* input mode for search */
#define B_IMODE_USE_INSERT -1 /* Use b_p_iminsert value for search */
#define B_IMODE_NONE 0 /* Input via none */
#define B_IMODE_LMAP 1 /* Input via langmap */
// flags for use of ":lmap" and IM control
long b_p_iminsert; // input mode for insert
long b_p_imsearch; // input mode for search
#define B_IMODE_USE_INSERT -1 // Use b_p_iminsert value for search
#define B_IMODE_NONE 0 // Input via none
#define B_IMODE_LMAP 1 // Input via langmap
# define B_IMODE_LAST 1
short b_kmap_state; /* using "lmap" mappings */
@@ -760,7 +760,7 @@ struct file_buffer {
/* Two special kinds of buffers:
* help buffer - used for help files, won't use a swap file.
* spell buffer - used for spell info, never displayed and doesn't have a
* file name.
* file name.
*/
bool b_help; /* TRUE for help file buffer (when set b_p_bt
is "help") */
@@ -787,6 +787,8 @@ struct file_buffer {
// array of channelids which have asked to receive updates for this
// buffer.
kvec_t(uint64_t) update_channels;
int b_diff_failed; // internal diff failed for this buffer
};
/*
@@ -840,6 +842,7 @@ struct tabpage_S {
diff_T *tp_first_diff;
buf_T *(tp_diffbuf[DB_COUNT]);
int tp_diff_invalid; ///< list of diffs is outdated
int tp_diff_update; ///< update diffs before redrawing
frame_T *(tp_snapshot[SNAP_COUNT]); ///< window layout snapshots
ScopeDictDictItem tp_winvar; ///< Variable for "t:" Dictionary.
dict_T *tp_vars; ///< Internal variables, local to tab page.
@@ -916,9 +919,9 @@ typedef struct {
/// Same as lpos_T, but with additional field len.
typedef struct
{
linenr_T lnum; ///< line number
colnr_T col; ///< column number
int len; ///< length: 0 - to the end of line
linenr_T lnum; ///< line number
colnr_T col; ///< column number
int len; ///< length: 0 - to the end of line
} llpos_T;
/// posmatch_T provides an array for storing match items for matchaddpos()
@@ -926,10 +929,10 @@ typedef struct
typedef struct posmatch posmatch_T;
struct posmatch
{
llpos_T pos[MAXPOSMATCH]; ///< array of positions
int cur; ///< internal position counter
linenr_T toplnum; ///< top buffer line
linenr_T botlnum; ///< bottom buffer line
llpos_T pos[MAXPOSMATCH]; ///< array of positions
int cur; ///< internal position counter
linenr_T toplnum; ///< top buffer line
linenr_T botlnum; ///< bottom buffer line
};
/*
@@ -1036,7 +1039,7 @@ struct window_S {
* 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.
* valid or need to be recomputed.
*/
int w_valid;
pos_T w_valid_cursor; /* last known position of w_cursor, used