mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor: fix clint warnings (#17682)
This commit is contained in:
parent
4ede2ea4b2
commit
4ba12b3dda
@ -111,7 +111,7 @@ bool try_leave(const TryState *const tstate, Error *const err)
|
|||||||
/// try_enter()/try_leave() pair should be used instead.
|
/// try_enter()/try_leave() pair should be used instead.
|
||||||
void try_start(void)
|
void try_start(void)
|
||||||
{
|
{
|
||||||
++trylevel;
|
trylevel++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// End try block, set the error message if any and return true if an error
|
/// End try block, set the error message if any and return true if an error
|
||||||
@ -1037,8 +1037,7 @@ static void set_option_value_for(char *key, int numval, char *stringval, int opt
|
|||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
|
|
||||||
try_start();
|
try_start();
|
||||||
switch (opt_type)
|
switch (opt_type) {
|
||||||
{
|
|
||||||
case SREQ_WIN:
|
case SREQ_WIN:
|
||||||
if (switch_win_noblock(&switchwin, (win_T *)from, win_find_tabpage((win_T *)from), true)
|
if (switch_win_noblock(&switchwin, (win_T *)from, win_find_tabpage((win_T *)from), true)
|
||||||
== FAIL) {
|
== FAIL) {
|
||||||
|
@ -219,7 +219,7 @@ void nvim_feedkeys(String keys, String mode, Boolean escape_ks)
|
|||||||
bool execute = false;
|
bool execute = false;
|
||||||
bool dangerous = false;
|
bool dangerous = false;
|
||||||
|
|
||||||
for (size_t i = 0; i < mode.size; ++i) {
|
for (size_t i = 0; i < mode.size; i++) {
|
||||||
switch (mode.data[i]) {
|
switch (mode.data[i]) {
|
||||||
case 'n':
|
case 'n':
|
||||||
remap = false; break;
|
remap = false; break;
|
||||||
@ -1880,7 +1880,7 @@ static void write_msg(String message, bool to_err)
|
|||||||
} \
|
} \
|
||||||
line_buf[pos++] = message.data[i];
|
line_buf[pos++] = message.data[i];
|
||||||
|
|
||||||
++no_wait_return;
|
no_wait_return++;
|
||||||
for (uint32_t i = 0; i < message.size; i++) {
|
for (uint32_t i = 0; i < message.size; i++) {
|
||||||
if (got_int) {
|
if (got_int) {
|
||||||
break;
|
break;
|
||||||
@ -1891,7 +1891,7 @@ static void write_msg(String message, bool to_err)
|
|||||||
PUSH_CHAR(i, out_pos, out_line_buf, msg);
|
PUSH_CHAR(i, out_pos, out_line_buf, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--no_wait_return;
|
no_wait_return--;
|
||||||
msg_end();
|
msg_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ int buf_init_chartab(buf_T *buf, int global)
|
|||||||
|
|
||||||
if ((*p == '^') && (p[1] != NUL)) {
|
if ((*p == '^') && (p[1] != NUL)) {
|
||||||
tilde = true;
|
tilde = true;
|
||||||
++p;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ascii_isdigit(*p)) {
|
if (ascii_isdigit(*p)) {
|
||||||
@ -170,7 +170,7 @@ int buf_init_chartab(buf_T *buf, int global)
|
|||||||
c2 = -1;
|
c2 = -1;
|
||||||
|
|
||||||
if ((*p == '-') && (p[1] != NUL)) {
|
if ((*p == '-') && (p[1] != NUL)) {
|
||||||
++p;
|
p++;
|
||||||
|
|
||||||
if (ascii_isdigit(*p)) {
|
if (ascii_isdigit(*p)) {
|
||||||
c2 = getdigits_int((char_u **)&p, true, 0);
|
c2 = getdigits_int((char_u **)&p, true, 0);
|
||||||
@ -243,7 +243,7 @@ int buf_init_chartab(buf_T *buf, int global)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++c;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = *p;
|
c = *p;
|
||||||
@ -292,7 +292,7 @@ void trans_characters(char_u *buf, int bufsize)
|
|||||||
memmove(buf + trs_len, buf + 1, (size_t)len);
|
memmove(buf + trs_len, buf + 1, (size_t)len);
|
||||||
}
|
}
|
||||||
memmove(buf, trs, (size_t)trs_len);
|
memmove(buf, trs, (size_t)trs_len);
|
||||||
--len;
|
len--;
|
||||||
}
|
}
|
||||||
buf += trs_len;
|
buf += trs_len;
|
||||||
}
|
}
|
||||||
@ -1314,9 +1314,9 @@ char_u *skiptowhite_esc(char_u *p)
|
|||||||
{
|
{
|
||||||
while (*p != ' ' && *p != '\t' && *p != NUL) {
|
while (*p != ' ' && *p != '\t' && *p != NUL) {
|
||||||
if (((*p == '\\') || (*p == Ctrl_V)) && (*(p + 1) != NUL)) {
|
if (((*p == '\\') || (*p == Ctrl_V)) && (*(p + 1) != NUL)) {
|
||||||
++p;
|
p++;
|
||||||
}
|
}
|
||||||
++p;
|
p++;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -1686,7 +1686,7 @@ bool rem_backslash(const char_u *str)
|
|||||||
/// @param p
|
/// @param p
|
||||||
void backslash_halve(char_u *p)
|
void backslash_halve(char_u *p)
|
||||||
{
|
{
|
||||||
for (; *p; ++p) {
|
for (; *p; p++) {
|
||||||
if (rem_backslash(p)) {
|
if (rem_backslash(p)) {
|
||||||
STRMOVE(p, p + 1);
|
STRMOVE(p, p + 1);
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,7 @@
|
|||||||
# include "cursor.c.generated.h"
|
# include "cursor.c.generated.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/// @return the screen position of the cursor.
|
||||||
* Get the screen position of the cursor.
|
|
||||||
*/
|
|
||||||
int getviscol(void)
|
int getviscol(void)
|
||||||
{
|
{
|
||||||
colnr_T x;
|
colnr_T x;
|
||||||
@ -36,9 +34,7 @@ int getviscol(void)
|
|||||||
return (int)x;
|
return (int)x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// @return the screen position of character col with a coladd in the cursor line.
|
||||||
* Get the screen position of character col with a coladd in the cursor line.
|
|
||||||
*/
|
|
||||||
int getviscol2(colnr_T col, colnr_T coladd)
|
int getviscol2(colnr_T col, colnr_T coladd)
|
||||||
{
|
{
|
||||||
colnr_T x;
|
colnr_T x;
|
||||||
@ -51,11 +47,9 @@ int getviscol2(colnr_T col, colnr_T coladd)
|
|||||||
return (int)x;
|
return (int)x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Go to column "wcol", and add/insert white space as necessary to get the
|
||||||
* Go to column "wcol", and add/insert white space as necessary to get the
|
/// cursor in that column.
|
||||||
* cursor in that column.
|
/// The caller must have saved the cursor line for undo!
|
||||||
* The caller must have saved the cursor line for undo!
|
|
||||||
*/
|
|
||||||
int coladvance_force(colnr_T wcol)
|
int coladvance_force(colnr_T wcol)
|
||||||
{
|
{
|
||||||
int rc = coladvance2(&curwin->w_cursor, true, false, wcol);
|
int rc = coladvance2(&curwin->w_cursor, true, false, wcol);
|
||||||
@ -70,15 +64,13 @@ int coladvance_force(colnr_T wcol)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Try to advance the Cursor to the specified screen column.
|
||||||
* Try to advance the Cursor to the specified screen column.
|
/// If virtual editing: fine tune the cursor position.
|
||||||
* If virtual editing: fine tune the cursor position.
|
/// Note that all virtual positions off the end of a line should share
|
||||||
* Note that all virtual positions off the end of a line should share
|
/// a curwin->w_cursor.col value (n.b. this is equal to STRLEN(line)),
|
||||||
* a curwin->w_cursor.col value (n.b. this is equal to STRLEN(line)),
|
/// beginning at coladd 0.
|
||||||
* beginning at coladd 0.
|
///
|
||||||
*
|
/// @return OK if desired column is reached, FAIL if not
|
||||||
* return OK if desired column is reached, FAIL if not
|
|
||||||
*/
|
|
||||||
int coladvance(colnr_T wcol)
|
int coladvance(colnr_T wcol)
|
||||||
{
|
{
|
||||||
int rc = getvpos(&curwin->w_cursor, wcol);
|
int rc = getvpos(&curwin->w_cursor, wcol);
|
||||||
@ -121,7 +113,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
|
|||||||
if ((addspaces || finetune) && !VIsual_active) {
|
if ((addspaces || finetune) && !VIsual_active) {
|
||||||
curwin->w_curswant = linetabsize(line) + one_more;
|
curwin->w_curswant = linetabsize(line) + one_more;
|
||||||
if (curwin->w_curswant > 0) {
|
if (curwin->w_curswant > 0) {
|
||||||
--curwin->w_curswant;
|
curwin->w_curswant--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -139,10 +131,10 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
|
|||||||
|
|
||||||
if (wcol / width > (colnr_T)csize / width
|
if (wcol / width > (colnr_T)csize / width
|
||||||
&& ((State & INSERT) == 0 || (int)wcol > csize + 1)) {
|
&& ((State & INSERT) == 0 || (int)wcol > csize + 1)) {
|
||||||
/* In case of line wrapping don't move the cursor beyond the
|
// In case of line wrapping don't move the cursor beyond the
|
||||||
* right screen edge. In Insert mode allow going just beyond
|
// right screen edge. In Insert mode allow going just beyond
|
||||||
* the last character (like what happens when typing and
|
// the last character (like what happens when typing and
|
||||||
* reaching the right window edge). */
|
// reaching the right window edge).
|
||||||
wcol = (csize / width + 1) * width - 1;
|
wcol = (csize / width + 1) * width - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,12 +147,10 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
|
|||||||
col += csize;
|
col += csize;
|
||||||
}
|
}
|
||||||
idx = (int)(ptr - line);
|
idx = (int)(ptr - line);
|
||||||
/*
|
// Handle all the special cases. The virtual_active() check
|
||||||
* Handle all the special cases. The virtual_active() check
|
// is needed to ensure that a virtual position off the end of
|
||||||
* is needed to ensure that a virtual position off the end of
|
// a line has the correct indexing. The one_more comparison
|
||||||
* a line has the correct indexing. The one_more comparison
|
// replaces an explicit add of one_more later on.
|
||||||
* replaces an explicit add of one_more later on.
|
|
||||||
*/
|
|
||||||
if (col > wcol || (!virtual_active() && one_more == 0)) {
|
if (col > wcol || (!virtual_active() && one_more == 0)) {
|
||||||
idx -= 1;
|
idx -= 1;
|
||||||
// Don't count the chars from 'showbreak'.
|
// Don't count the chars from 'showbreak'.
|
||||||
@ -172,8 +162,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
|
|||||||
&& addspaces
|
&& addspaces
|
||||||
&& wcol >= 0
|
&& wcol >= 0
|
||||||
&& ((col != wcol && col != wcol + 1) || csize > 1)) {
|
&& ((col != wcol && col != wcol + 1) || csize > 1)) {
|
||||||
/* 'virtualedit' is set: The difference between wcol and col is
|
// 'virtualedit' is set: The difference between wcol and col is filled with spaces.
|
||||||
* filled with spaces. */
|
|
||||||
|
|
||||||
if (line[idx] == NUL) {
|
if (line[idx] == NUL) {
|
||||||
// Append spaces
|
// Append spaces
|
||||||
@ -256,29 +245,23 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Return in "pos" the position of the cursor advanced to screen column "wcol".
|
||||||
* Return in "pos" the position of the cursor advanced to screen column "wcol".
|
///
|
||||||
* return OK if desired column is reached, FAIL if not
|
/// @return OK if desired column is reached, FAIL if not
|
||||||
*/
|
|
||||||
int getvpos(pos_T *pos, colnr_T wcol)
|
int getvpos(pos_T *pos, colnr_T wcol)
|
||||||
{
|
{
|
||||||
return coladvance2(pos, false, virtual_active(), wcol);
|
return coladvance2(pos, false, virtual_active(), wcol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Increment the cursor position. See inc() for return values.
|
||||||
* Increment the cursor position. See inc() for return values.
|
|
||||||
*/
|
|
||||||
int inc_cursor(void)
|
int inc_cursor(void)
|
||||||
{
|
{
|
||||||
return inc(&curwin->w_cursor);
|
return inc(&curwin->w_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Decrement the line pointer 'p' crossing line boundaries as necessary.
|
||||||
* dec(p)
|
///
|
||||||
*
|
/// @return 1 when crossing a line, -1 when at start of file, 0 otherwise.
|
||||||
* Decrement the line pointer 'p' crossing line boundaries as necessary.
|
|
||||||
* Return 1 when crossing a line, -1 when at start of file, 0 otherwise.
|
|
||||||
*/
|
|
||||||
int dec_cursor(void)
|
int dec_cursor(void)
|
||||||
{
|
{
|
||||||
return dec(&curwin->w_cursor);
|
return dec(&curwin->w_cursor);
|
||||||
@ -314,8 +297,8 @@ linenr_T get_cursor_rel_lnum(win_T *wp, linenr_T lnum)
|
|||||||
return (lnum < cursor) ? -retval : retval;
|
return (lnum < cursor) ? -retval : retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure "pos.lnum" and "pos.col" are valid in "buf".
|
/// Make sure "pos.lnum" and "pos.col" are valid in "buf".
|
||||||
// This allows for the col to be on the NUL byte.
|
/// This allows for the col to be on the NUL byte.
|
||||||
void check_pos(buf_T *buf, pos_T *pos)
|
void check_pos(buf_T *buf, pos_T *pos)
|
||||||
{
|
{
|
||||||
char_u *line;
|
char_u *line;
|
||||||
@ -334,14 +317,12 @@ void check_pos(buf_T *buf, pos_T *pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Make sure curwin->w_cursor.lnum is valid.
|
||||||
* Make sure curwin->w_cursor.lnum is valid.
|
|
||||||
*/
|
|
||||||
void check_cursor_lnum(void)
|
void check_cursor_lnum(void)
|
||||||
{
|
{
|
||||||
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
|
||||||
/* If there is a closed fold at the end of the file, put the cursor in
|
// If there is a closed fold at the end of the file, put the cursor in
|
||||||
* its first line. Otherwise in the last line. */
|
// its first line. Otherwise in the last line.
|
||||||
if (!hasFolding(curbuf->b_ml.ml_line_count,
|
if (!hasFolding(curbuf->b_ml.ml_line_count,
|
||||||
&curwin->w_cursor.lnum, NULL)) {
|
&curwin->w_cursor.lnum, NULL)) {
|
||||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||||
@ -352,9 +333,7 @@ void check_cursor_lnum(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Make sure curwin->w_cursor.col is valid.
|
||||||
* Make sure curwin->w_cursor.col is valid.
|
|
||||||
*/
|
|
||||||
void check_cursor_col(void)
|
void check_cursor_col(void)
|
||||||
{
|
{
|
||||||
check_cursor_col_win(curwin);
|
check_cursor_col_win(curwin);
|
||||||
@ -373,10 +352,10 @@ void check_cursor_col_win(win_T *win)
|
|||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
win->w_cursor.col = 0;
|
win->w_cursor.col = 0;
|
||||||
} else if (win->w_cursor.col >= len) {
|
} else if (win->w_cursor.col >= len) {
|
||||||
/* Allow cursor past end-of-line when:
|
// Allow cursor past end-of-line when:
|
||||||
* - in Insert mode or restarting Insert mode
|
// - in Insert mode or restarting Insert mode
|
||||||
* - in Visual mode and 'selection' isn't "old"
|
// - in Visual mode and 'selection' isn't "old"
|
||||||
* - 'virtualedit' is set */
|
// - 'virtualedit' is set */
|
||||||
if ((State & INSERT) || restart_edit
|
if ((State & INSERT) || restart_edit
|
||||||
|| (VIsual_active && *p_sel != 'o')
|
|| (VIsual_active && *p_sel != 'o')
|
||||||
|| (cur_ve_flags & VE_ONEMORE)
|
|| (cur_ve_flags & VE_ONEMORE)
|
||||||
@ -419,32 +398,27 @@ void check_cursor_col_win(win_T *win)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Make sure curwin->w_cursor in on a valid character
|
||||||
* make sure curwin->w_cursor in on a valid character
|
|
||||||
*/
|
|
||||||
void check_cursor(void)
|
void check_cursor(void)
|
||||||
{
|
{
|
||||||
check_cursor_lnum();
|
check_cursor_lnum();
|
||||||
check_cursor_col();
|
check_cursor_col();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Make sure curwin->w_cursor is not on the NUL at the end of the line.
|
||||||
* Make sure curwin->w_cursor is not on the NUL at the end of the line.
|
/// Allow it when in Visual mode and 'selection' is not "old".
|
||||||
* Allow it when in Visual mode and 'selection' is not "old".
|
|
||||||
*/
|
|
||||||
void adjust_cursor_col(void)
|
void adjust_cursor_col(void)
|
||||||
{
|
{
|
||||||
if (curwin->w_cursor.col > 0
|
if (curwin->w_cursor.col > 0
|
||||||
&& (!VIsual_active || *p_sel == 'o')
|
&& (!VIsual_active || *p_sel == 'o')
|
||||||
&& gchar_cursor() == NUL) {
|
&& gchar_cursor() == NUL) {
|
||||||
--curwin->w_cursor.col;
|
curwin->w_cursor.col--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// When curwin->w_leftcol has changed, adjust the cursor position.
|
||||||
* When curwin->w_leftcol has changed, adjust the cursor position.
|
///
|
||||||
* Return true if the cursor was moved.
|
/// @return true if the cursor was moved.
|
||||||
*/
|
|
||||||
bool leftcol_changed(void)
|
bool leftcol_changed(void)
|
||||||
{
|
{
|
||||||
// TODO(hinidu): I think it should be colnr_T or int, but p_siso is long.
|
// TODO(hinidu): I think it should be colnr_T or int, but p_siso is long.
|
||||||
@ -457,10 +431,8 @@ bool leftcol_changed(void)
|
|||||||
lastcol = curwin->w_leftcol + curwin->w_width_inner - curwin_col_off() - 1;
|
lastcol = curwin->w_leftcol + curwin->w_width_inner - curwin_col_off() - 1;
|
||||||
validate_virtcol();
|
validate_virtcol();
|
||||||
|
|
||||||
/*
|
// If the cursor is right or left of the screen, move it to last or first
|
||||||
* If the cursor is right or left of the screen, move it to last or first
|
// character.
|
||||||
* character.
|
|
||||||
*/
|
|
||||||
if (curwin->w_virtcol > (colnr_T)(lastcol - p_siso)) {
|
if (curwin->w_virtcol > (colnr_T)(lastcol - p_siso)) {
|
||||||
retval = true;
|
retval = true;
|
||||||
coladvance((colnr_T)(lastcol - p_siso));
|
coladvance((colnr_T)(lastcol - p_siso));
|
||||||
@ -469,11 +441,9 @@ bool leftcol_changed(void)
|
|||||||
coladvance((colnr_T)(curwin->w_leftcol + p_siso));
|
coladvance((colnr_T)(curwin->w_leftcol + p_siso));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// If the start of the character under the cursor is not on the screen,
|
||||||
* If the start of the character under the cursor is not on the screen,
|
// advance the cursor one more char. If this fails (last char of the
|
||||||
* advance the cursor one more char. If this fails (last char of the
|
// line) adjust the scrolling.
|
||||||
* line) adjust the scrolling.
|
|
||||||
*/
|
|
||||||
getvvcol(curwin, &curwin->w_cursor, &s, NULL, &e);
|
getvvcol(curwin, &curwin->w_cursor, &s, NULL, &e);
|
||||||
if (e > (colnr_T)lastcol) {
|
if (e > (colnr_T)lastcol) {
|
||||||
retval = true;
|
retval = true;
|
||||||
@ -498,27 +468,21 @@ int gchar_cursor(void)
|
|||||||
return utf_ptr2char(get_cursor_pos_ptr());
|
return utf_ptr2char(get_cursor_pos_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Write a character at the current cursor position.
|
||||||
* Write a character at the current cursor position.
|
/// It is directly written into the block.
|
||||||
* It is directly written into the block.
|
|
||||||
*/
|
|
||||||
void pchar_cursor(char_u c)
|
void pchar_cursor(char_u c)
|
||||||
{
|
{
|
||||||
*(ml_get_buf(curbuf, curwin->w_cursor.lnum, true)
|
*(ml_get_buf(curbuf, curwin->w_cursor.lnum, true)
|
||||||
+ curwin->w_cursor.col) = c;
|
+ curwin->w_cursor.col) = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// @return pointer to cursor line.
|
||||||
* Return pointer to cursor line.
|
|
||||||
*/
|
|
||||||
char_u *get_cursor_line_ptr(void)
|
char_u *get_cursor_line_ptr(void)
|
||||||
{
|
{
|
||||||
return ml_get_buf(curbuf, curwin->w_cursor.lnum, false);
|
return ml_get_buf(curbuf, curwin->w_cursor.lnum, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// @return pointer to cursor position.
|
||||||
* Return pointer to cursor position.
|
|
||||||
*/
|
|
||||||
char_u *get_cursor_pos_ptr(void)
|
char_u *get_cursor_pos_ptr(void)
|
||||||
{
|
{
|
||||||
return ml_get_buf(curbuf, curwin->w_cursor.lnum, false) +
|
return ml_get_buf(curbuf, curwin->w_cursor.lnum, false) +
|
||||||
|
@ -74,8 +74,7 @@ Array mode_style_array(void)
|
|||||||
PUT(dic, "hl_id", INTEGER_OBJ(cur->id));
|
PUT(dic, "hl_id", INTEGER_OBJ(cur->id));
|
||||||
PUT(dic, "id_lm", INTEGER_OBJ(cur->id_lm));
|
PUT(dic, "id_lm", INTEGER_OBJ(cur->id_lm));
|
||||||
PUT(dic, "attr_id", INTEGER_OBJ(cur->id ? syn_id2attr(cur->id) : 0));
|
PUT(dic, "attr_id", INTEGER_OBJ(cur->id ? syn_id2attr(cur->id) : 0));
|
||||||
PUT(dic, "attr_id_lm", INTEGER_OBJ(cur->id_lm ? syn_id2attr(cur->id_lm)
|
PUT(dic, "attr_id_lm", INTEGER_OBJ(cur->id_lm ? syn_id2attr(cur->id_lm) : 0));
|
||||||
: 0));
|
|
||||||
}
|
}
|
||||||
PUT(dic, "name", STRING_OBJ(cstr_to_string(cur->full_name)));
|
PUT(dic, "name", STRING_OBJ(cstr_to_string(cur->full_name)));
|
||||||
PUT(dic, "short_name", STRING_OBJ(cstr_to_string(cur->name)));
|
PUT(dic, "short_name", STRING_OBJ(cstr_to_string(cur->name)));
|
||||||
@ -147,7 +146,7 @@ char *parse_shape_opt(int what)
|
|||||||
if (len == 1 && TOLOWER_ASC(modep[0]) == 'a') {
|
if (len == 1 && TOLOWER_ASC(modep[0]) == 'a') {
|
||||||
all_idx = SHAPE_IDX_COUNT - 1;
|
all_idx = SHAPE_IDX_COUNT - 1;
|
||||||
} else {
|
} else {
|
||||||
for (idx = 0; idx < SHAPE_IDX_COUNT; ++idx) {
|
for (idx = 0; idx < SHAPE_IDX_COUNT; idx++) {
|
||||||
if (STRNICMP(modep, shape_table[idx].name, len) == 0) {
|
if (STRNICMP(modep, shape_table[idx].name, len) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -170,9 +169,7 @@ char *parse_shape_opt(int what)
|
|||||||
// Parse the part after the colon
|
// Parse the part after the colon
|
||||||
for (p = colonp + 1; *p && *p != ',';) {
|
for (p = colonp + 1; *p && *p != ',';) {
|
||||||
{
|
{
|
||||||
/*
|
// First handle the ones with a number argument.
|
||||||
* First handle the ones with a number argument.
|
|
||||||
*/
|
|
||||||
i = *p;
|
i = *p;
|
||||||
len = 0;
|
len = 0;
|
||||||
if (STRNICMP(p, "ver", 3) == 0) {
|
if (STRNICMP(p, "ver", 3) == 0) {
|
||||||
@ -245,7 +242,7 @@ char *parse_shape_opt(int what)
|
|||||||
} // if (what != SHAPE_MOUSE)
|
} // if (what != SHAPE_MOUSE)
|
||||||
|
|
||||||
if (*p == '-') {
|
if (*p == '-') {
|
||||||
++p;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ void diff_buf_add(buf_T *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if (curtab->tp_diffbuf[i] == NULL) {
|
if (curtab->tp_diffbuf[i] == NULL) {
|
||||||
curtab->tp_diffbuf[i] = buf;
|
curtab->tp_diffbuf[i] = buf;
|
||||||
curtab->tp_diff_invalid = true;
|
curtab->tp_diff_invalid = true;
|
||||||
@ -201,7 +201,7 @@ static void diff_buf_clear(void)
|
|||||||
static int diff_buf_idx(buf_T *buf)
|
static int diff_buf_idx(buf_T *buf)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
for (idx = 0; idx < DB_COUNT; ++idx) {
|
for (idx = 0; idx < DB_COUNT; idx++) {
|
||||||
if (curtab->tp_diffbuf[idx] == buf) {
|
if (curtab->tp_diffbuf[idx] == buf) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ static int diff_buf_idx(buf_T *buf)
|
|||||||
static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp)
|
static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
for (idx = 0; idx < DB_COUNT; ++idx) {
|
for (idx = 0; idx < DB_COUNT; idx++) {
|
||||||
if (tp->tp_diffbuf[idx] == buf) {
|
if (tp->tp_diffbuf[idx] == buf) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
|
|||||||
dnext->df_lnum[idx] = line1;
|
dnext->df_lnum[idx] = line1;
|
||||||
dnext->df_count[idx] = inserted;
|
dnext->df_count[idx] = inserted;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((tp->tp_diffbuf[i] != NULL) && (i != idx)) {
|
if ((tp->tp_diffbuf[i] != NULL) && (i != idx)) {
|
||||||
if (dprev == NULL) {
|
if (dprev == NULL) {
|
||||||
dnext->df_lnum[i] = line1;
|
dnext->df_lnum[i] = line1;
|
||||||
@ -421,7 +421,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((tp->tp_diffbuf[i] != NULL) && (i != idx)) {
|
if ((tp->tp_diffbuf[i] != NULL) && (i != idx)) {
|
||||||
dp->df_lnum[i] -= off;
|
dp->df_lnum[i] -= off;
|
||||||
dp->df_count[i] += n;
|
dp->df_count[i] += n;
|
||||||
@ -442,7 +442,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
|
|||||||
// Check if inserted lines are equal, may reduce the size of the
|
// Check if inserted lines are equal, may reduce the size of the
|
||||||
// diff.
|
// diff.
|
||||||
//
|
//
|
||||||
// TODO: also check for equal lines in the middle and perhaps split
|
// TODO(unknown): also check for equal lines in the middle and perhaps split
|
||||||
// the block.
|
// the block.
|
||||||
diff_check_unchanged(tp, dp);
|
diff_check_unchanged(tp, dp);
|
||||||
}
|
}
|
||||||
@ -453,7 +453,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
|
|||||||
if ((dprev != NULL)
|
if ((dprev != NULL)
|
||||||
&& (dprev->df_lnum[idx] + dprev->df_count[idx] == dp->df_lnum[idx])) {
|
&& (dprev->df_lnum[idx] + dprev->df_count[idx] == dp->df_lnum[idx])) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if (tp->tp_diffbuf[i] != NULL) {
|
if (tp->tp_diffbuf[i] != NULL) {
|
||||||
dprev->df_count[i] += dp->df_count[i];
|
dprev->df_count[i] += dp->df_count[i];
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
|
|||||||
while (dp != NULL) {
|
while (dp != NULL) {
|
||||||
// All counts are zero, remove this entry.
|
// All counts are zero, remove this entry.
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((tp->tp_diffbuf[i] != NULL) && (dp->df_count[i] != 0)) {
|
if ((tp->tp_diffbuf[i] != NULL) && (dp->df_count[i] != 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -542,7 +542,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
|
|||||||
// Find the first buffers, use it as the original, compare the other
|
// Find the first buffers, use it as the original, compare the other
|
||||||
// buffer lines against this one.
|
// buffer lines against this one.
|
||||||
int i_org;
|
int i_org;
|
||||||
for (i_org = 0; i_org < DB_COUNT; ++i_org) {
|
for (i_org = 0; i_org < DB_COUNT; i_org++) {
|
||||||
if (tp->tp_diffbuf[i_org] != NULL) {
|
if (tp->tp_diffbuf[i_org] != NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -574,7 +574,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
|
|||||||
false));
|
false));
|
||||||
|
|
||||||
int i_new;
|
int i_new;
|
||||||
for (i_new = i_org + 1; i_new < DB_COUNT; ++i_new) {
|
for (i_new = i_org + 1; i_new < DB_COUNT; i_new++) {
|
||||||
if (tp->tp_diffbuf[i_new] == NULL) {
|
if (tp->tp_diffbuf[i_new] == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -602,7 +602,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Line matched in all buffers, remove it from the diff.
|
// Line matched in all buffers, remove it from the diff.
|
||||||
for (i_new = i_org; i_new < DB_COUNT; ++i_new) {
|
for (i_new = i_org; i_new < DB_COUNT; i_new++) {
|
||||||
if (tp->tp_diffbuf[i_new] != NULL) {
|
if (tp->tp_diffbuf[i_new] != NULL) {
|
||||||
if (dir == FORWARD) {
|
if (dir == FORWARD) {
|
||||||
dp->df_lnum[i_new]++;
|
dp->df_lnum[i_new]++;
|
||||||
@ -629,7 +629,7 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
|
|||||||
static int diff_check_sanity(tabpage_T *tp, diff_T *dp)
|
static int diff_check_sanity(tabpage_T *tp, diff_T *dp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if (tp->tp_diffbuf[i] != NULL) {
|
if (tp->tp_diffbuf[i] != NULL) {
|
||||||
if (dp->df_lnum[i] + dp->df_count[i] - 1
|
if (dp->df_lnum[i] + dp->df_count[i] - 1
|
||||||
> tp->tp_diffbuf[i]->b_ml.ml_line_count) {
|
> tp->tp_diffbuf[i]->b_ml.ml_line_count) {
|
||||||
@ -927,7 +927,7 @@ void ex_diffupdate(exarg_T *eap)
|
|||||||
|
|
||||||
// Use the first buffer as the original text.
|
// Use the first buffer as the original text.
|
||||||
int idx_orig;
|
int idx_orig;
|
||||||
for (idx_orig = 0; idx_orig < DB_COUNT; ++idx_orig) {
|
for (idx_orig = 0; idx_orig < DB_COUNT; idx_orig++) {
|
||||||
if (curtab->tp_diffbuf[idx_orig] != NULL) {
|
if (curtab->tp_diffbuf[idx_orig] != NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -939,7 +939,7 @@ void ex_diffupdate(exarg_T *eap)
|
|||||||
|
|
||||||
// Only need to do something when there is another buffer.
|
// Only need to do something when there is another buffer.
|
||||||
int idx_new;
|
int idx_new;
|
||||||
for (idx_new = idx_orig + 1; idx_new < DB_COUNT; ++idx_new) {
|
for (idx_new = idx_orig + 1; idx_new < DB_COUNT; idx_new++) {
|
||||||
if (curtab->tp_diffbuf[idx_new] != NULL) {
|
if (curtab->tp_diffbuf[idx_new] != NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1659,7 +1659,7 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
|
|||||||
off = dp->df_lnum[idx_orig] - hunk->lnum_orig;
|
off = dp->df_lnum[idx_orig] - hunk->lnum_orig;
|
||||||
|
|
||||||
if (off > 0) {
|
if (off > 0) {
|
||||||
for (i = idx_orig; i < idx_new; ++i) {
|
for (i = idx_orig; i < idx_new; i++) {
|
||||||
if (curtab->tp_diffbuf[i] != NULL) {
|
if (curtab->tp_diffbuf[i] != NULL) {
|
||||||
dp->df_lnum[i] -= off;
|
dp->df_lnum[i] -= off;
|
||||||
}
|
}
|
||||||
@ -1693,7 +1693,7 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
|
|||||||
off = 0;
|
off = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = idx_orig; i < idx_new; ++i) {
|
for (i = idx_orig; i < idx_new; i++) {
|
||||||
if (curtab->tp_diffbuf[i] != NULL) {
|
if (curtab->tp_diffbuf[i] != NULL) {
|
||||||
dp->df_count[i] = dpl->df_lnum[i] + dpl->df_count[i]
|
dp->df_count[i] = dpl->df_lnum[i] + dpl->df_count[i]
|
||||||
- dp->df_lnum[i] + off;
|
- dp->df_lnum[i] + off;
|
||||||
@ -1721,7 +1721,7 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
|
|||||||
// Set values for other buffers, these must be equal to the
|
// Set values for other buffers, these must be equal to the
|
||||||
// original buffer, otherwise there would have been a change
|
// original buffer, otherwise there would have been a change
|
||||||
// already.
|
// already.
|
||||||
for (i = idx_orig + 1; i < idx_new; ++i) {
|
for (i = idx_orig + 1; i < idx_new; i++) {
|
||||||
if (curtab->tp_diffbuf[i] != NULL) {
|
if (curtab->tp_diffbuf[i] != NULL) {
|
||||||
diff_copy_entry(dprev, dp, idx_orig, i);
|
diff_copy_entry(dprev, dp, idx_orig, i);
|
||||||
}
|
}
|
||||||
@ -1852,7 +1852,7 @@ int diff_check(win_T *wp, linenr_T lnum)
|
|||||||
// count, check if the lines are identical.
|
// count, check if the lines are identical.
|
||||||
cmp = false;
|
cmp = false;
|
||||||
|
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((i != idx) && (curtab->tp_diffbuf[i] != NULL)) {
|
if ((i != idx) && (curtab->tp_diffbuf[i] != NULL)) {
|
||||||
if (dp->df_count[i] == 0) {
|
if (dp->df_count[i] == 0) {
|
||||||
zero = true;
|
zero = true;
|
||||||
@ -1869,7 +1869,7 @@ int diff_check(win_T *wp, linenr_T lnum)
|
|||||||
if (cmp) {
|
if (cmp) {
|
||||||
// Compare all lines. If they are equal the lines were inserted
|
// Compare all lines. If they are equal the lines were inserted
|
||||||
// in some buffers, deleted in others, but not changed.
|
// in some buffers, deleted in others, but not changed.
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((i != idx)
|
if ((i != idx)
|
||||||
&& (curtab->tp_diffbuf[i] != NULL)
|
&& (curtab->tp_diffbuf[i] != NULL)
|
||||||
&& (dp->df_count[i] != 0)) {
|
&& (dp->df_count[i] != 0)) {
|
||||||
@ -1899,7 +1899,7 @@ int diff_check(win_T *wp, linenr_T lnum)
|
|||||||
// Insert filler lines above the line just below the change. Will return
|
// Insert filler lines above the line just below the change. Will return
|
||||||
// 0 when this buf had the max count.
|
// 0 when this buf had the max count.
|
||||||
maxcount = 0;
|
maxcount = 0;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((curtab->tp_diffbuf[i] != NULL) && (dp->df_count[i] > maxcount)) {
|
if ((curtab->tp_diffbuf[i] != NULL) && (dp->df_count[i] > maxcount)) {
|
||||||
maxcount = dp->df_count[i];
|
maxcount = dp->df_count[i];
|
||||||
}
|
}
|
||||||
@ -2073,7 +2073,7 @@ void diff_set_topline(win_T *fromwin, win_T *towin)
|
|||||||
// buffers we need to know the largest count.
|
// buffers we need to know the largest count.
|
||||||
max_count = 0;
|
max_count = 0;
|
||||||
|
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((curtab->tp_diffbuf[i] != NULL) && (max_count < dp->df_count[i])) {
|
if ((curtab->tp_diffbuf[i] != NULL) && (max_count < dp->df_count[i])) {
|
||||||
max_count = dp->df_count[i];
|
max_count = dp->df_count[i];
|
||||||
}
|
}
|
||||||
@ -2219,7 +2219,7 @@ int diffopt_changed(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*p == ',') {
|
if (*p == ',') {
|
||||||
++p;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2322,7 +2322,7 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
|
|||||||
|
|
||||||
int off = lnum - dp->df_lnum[idx];
|
int off = lnum - dp->df_lnum[idx];
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((curtab->tp_diffbuf[i] != NULL) && (i != idx)) {
|
if ((curtab->tp_diffbuf[i] != NULL) && (i != idx)) {
|
||||||
// Skip lines that are not in the other change (filler lines).
|
// Skip lines that are not in the other change (filler lines).
|
||||||
if (off >= dp->df_count[i]) {
|
if (off >= dp->df_count[i]) {
|
||||||
@ -2430,7 +2430,7 @@ bool diff_infold(win_T *wp, linenr_T lnum)
|
|||||||
|
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if (curtab->tp_diffbuf[i] == wp->w_buffer) {
|
if (curtab->tp_diffbuf[i] == wp->w_buffer) {
|
||||||
idx = i;
|
idx = i;
|
||||||
} else if (curtab->tp_diffbuf[i] != NULL) {
|
} else if (curtab->tp_diffbuf[i] != NULL) {
|
||||||
@ -2480,7 +2480,7 @@ void nv_diffgetput(bool put, size_t count)
|
|||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
ea.arg = (char_u *)"";
|
ea.arg = (char_u *)"";
|
||||||
} else {
|
} else {
|
||||||
vim_snprintf(buf, 30, "%zu", count);
|
vim_snprintf(buf, sizeof(buf), "%zu", count);
|
||||||
ea.arg = (char_u *)buf;
|
ea.arg = (char_u *)buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2529,7 +2529,7 @@ void ex_diffgetput(exarg_T *eap)
|
|||||||
|
|
||||||
if (*eap->arg == NUL) {
|
if (*eap->arg == NUL) {
|
||||||
// No argument: Find the other buffer in the list of diff buffers.
|
// No argument: Find the other buffer in the list of diff buffers.
|
||||||
for (idx_other = 0; idx_other < DB_COUNT; ++idx_other) {
|
for (idx_other = 0; idx_other < DB_COUNT; idx_other++) {
|
||||||
if ((curtab->tp_diffbuf[idx_other] != curbuf)
|
if ((curtab->tp_diffbuf[idx_other] != curbuf)
|
||||||
&& (curtab->tp_diffbuf[idx_other] != NULL)) {
|
&& (curtab->tp_diffbuf[idx_other] != NULL)) {
|
||||||
if ((eap->cmdidx != CMD_diffput)
|
if ((eap->cmdidx != CMD_diffput)
|
||||||
@ -2550,7 +2550,7 @@ void ex_diffgetput(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check that there isn't a third buffer in the list
|
// Check that there isn't a third buffer in the list
|
||||||
for (i = idx_other + 1; i < DB_COUNT; ++i) {
|
for (i = idx_other + 1; i < DB_COUNT; i++) {
|
||||||
if ((curtab->tp_diffbuf[i] != curbuf)
|
if ((curtab->tp_diffbuf[i] != curbuf)
|
||||||
&& (curtab->tp_diffbuf[i] != NULL)
|
&& (curtab->tp_diffbuf[i] != NULL)
|
||||||
&& ((eap->cmdidx != CMD_diffput)
|
&& ((eap->cmdidx != CMD_diffput)
|
||||||
@ -2567,7 +2567,7 @@ void ex_diffgetput(exarg_T *eap)
|
|||||||
p--;
|
p--;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; ascii_isdigit(eap->arg[i]) && eap->arg + i < p; ++i) {
|
for (i = 0; ascii_isdigit(eap->arg[i]) && eap->arg + i < p; i++) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eap->arg + i == p) {
|
if (eap->arg + i == p) {
|
||||||
@ -2610,9 +2610,9 @@ void ex_diffgetput(exarg_T *eap)
|
|||||||
&& (eap->line1 == curbuf->b_ml.ml_line_count)
|
&& (eap->line1 == curbuf->b_ml.ml_line_count)
|
||||||
&& (diff_check(curwin, eap->line1) == 0)
|
&& (diff_check(curwin, eap->line1) == 0)
|
||||||
&& ((eap->line1 == 1) || (diff_check(curwin, eap->line1 - 1) == 0))) {
|
&& ((eap->line1 == 1) || (diff_check(curwin, eap->line1 - 1) == 0))) {
|
||||||
++eap->line2;
|
eap->line2++;
|
||||||
} else if (eap->line1 > 0) {
|
} else if (eap->line1 > 0) {
|
||||||
--eap->line1;
|
eap->line1--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2703,14 +2703,14 @@ void ex_diffgetput(exarg_T *eap)
|
|||||||
buf_empty = buf_is_empty(curbuf);
|
buf_empty = buf_is_empty(curbuf);
|
||||||
added = 0;
|
added = 0;
|
||||||
|
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; i++) {
|
||||||
// remember deleting the last line of the buffer
|
// remember deleting the last line of the buffer
|
||||||
buf_empty = curbuf->b_ml.ml_line_count == 1;
|
buf_empty = curbuf->b_ml.ml_line_count == 1;
|
||||||
ml_delete(lnum, false);
|
ml_delete(lnum, false);
|
||||||
added--;
|
added--;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < dp->df_count[idx_from] - start_skip - end_skip; ++i) {
|
for (i = 0; i < dp->df_count[idx_from] - start_skip - end_skip; i++) {
|
||||||
linenr_T nr = dp->df_lnum[idx_from] + start_skip + i;
|
linenr_T nr = dp->df_lnum[idx_from] + start_skip + i;
|
||||||
if (nr > curtab->tp_diffbuf[idx_from]->b_ml.ml_line_count) {
|
if (nr > curtab->tp_diffbuf[idx_from]->b_ml.ml_line_count) {
|
||||||
break;
|
break;
|
||||||
@ -2732,7 +2732,7 @@ void ex_diffgetput(exarg_T *eap)
|
|||||||
if ((start_skip == 0) && (end_skip == 0)) {
|
if ((start_skip == 0) && (end_skip == 0)) {
|
||||||
// Check if there are any other buffers and if the diff is
|
// Check if there are any other buffers and if the diff is
|
||||||
// equal in them.
|
// equal in them.
|
||||||
for (i = 0; i < DB_COUNT; ++i) {
|
for (i = 0; i < DB_COUNT; i++) {
|
||||||
if ((curtab->tp_diffbuf[i] != NULL)
|
if ((curtab->tp_diffbuf[i] != NULL)
|
||||||
&& (i != idx_from)
|
&& (i != idx_from)
|
||||||
&& (i != idx_to)
|
&& (i != idx_to)
|
||||||
@ -2835,7 +2835,7 @@ theend:
|
|||||||
static void diff_fold_update(diff_T *dp, int skip_idx)
|
static void diff_fold_update(diff_T *dp, int skip_idx)
|
||||||
{
|
{
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
for (int i = 0; i < DB_COUNT; ++i) {
|
for (int i = 0; i < DB_COUNT; i++) {
|
||||||
if ((curtab->tp_diffbuf[i] == wp->w_buffer) && (i != skip_idx)) {
|
if ((curtab->tp_diffbuf[i] == wp->w_buffer) && (i != skip_idx)) {
|
||||||
foldUpdate(wp, dp->df_lnum[i], dp->df_lnum[i] + dp->df_count[i]);
|
foldUpdate(wp, dp->df_lnum[i], dp->df_lnum[i] + dp->df_count[i]);
|
||||||
}
|
}
|
||||||
|
@ -1555,24 +1555,24 @@ static int getexactdigraph(int char1, int char2, bool meta_char)
|
|||||||
|
|
||||||
// Search user digraphs first.
|
// Search user digraphs first.
|
||||||
digr_T *dp = (digr_T *)user_digraphs.ga_data;
|
digr_T *dp = (digr_T *)user_digraphs.ga_data;
|
||||||
for (int i = 0; i < user_digraphs.ga_len; ++i) {
|
for (int i = 0; i < user_digraphs.ga_len; i++) {
|
||||||
if (((int)dp->char1 == char1) && ((int)dp->char2 == char2)) {
|
if (((int)dp->char1 == char1) && ((int)dp->char2 == char2)) {
|
||||||
retval = dp->result;
|
retval = dp->result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++dp;
|
dp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search default digraphs.
|
// Search default digraphs.
|
||||||
if (retval == 0) {
|
if (retval == 0) {
|
||||||
dp = digraphdefault;
|
dp = digraphdefault;
|
||||||
|
|
||||||
for (int i = 0; dp->char1 != 0; ++i) {
|
for (int i = 0; dp->char1 != 0; i++) {
|
||||||
if (((int)dp->char1 == char1) && ((int)dp->char2 == char2)) {
|
if (((int)dp->char1 == char1) && ((int)dp->char2 == char2)) {
|
||||||
retval = dp->result;
|
retval = dp->result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++dp;
|
dp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1647,12 +1647,12 @@ void putdigraph(char_u *str)
|
|||||||
dp = (digr_T *)user_digraphs.ga_data;
|
dp = (digr_T *)user_digraphs.ga_data;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < user_digraphs.ga_len; ++i) {
|
for (i = 0; i < user_digraphs.ga_len; i++) {
|
||||||
if (((int)dp->char1 == char1) && ((int)dp->char2 == char2)) {
|
if (((int)dp->char1 == char1) && ((int)dp->char2 == char2)) {
|
||||||
dp->result = n;
|
dp->result = n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++dp;
|
dp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new digraph to the table.
|
// Add a new digraph to the table.
|
||||||
@ -1684,7 +1684,7 @@ void listdigraphs(bool use_headers)
|
|||||||
|
|
||||||
dp = digraphdefault;
|
dp = digraphdefault;
|
||||||
|
|
||||||
for (int i = 0; dp->char1 != NUL && !got_int; ++i) {
|
for (int i = 0; dp->char1 != NUL && !got_int; i++) {
|
||||||
digr_T tmp;
|
digr_T tmp;
|
||||||
|
|
||||||
// May need to convert the result to 'encoding'.
|
// May need to convert the result to 'encoding'.
|
||||||
@ -1911,7 +1911,7 @@ void ex_loadkeymap(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
xfree(kp->from);
|
xfree(kp->from);
|
||||||
xfree(kp->to);
|
xfree(kp->to);
|
||||||
--curbuf->b_kmap_ga.ga_len;
|
curbuf->b_kmap_ga.ga_len--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xfree(line);
|
xfree(line);
|
||||||
|
@ -53,10 +53,8 @@ int socket_watcher_init(Loop *loop, SocketWatcher *watcher, const char *endpoint
|
|||||||
uv_getaddrinfo_t request;
|
uv_getaddrinfo_t request;
|
||||||
|
|
||||||
int retval = uv_getaddrinfo(&loop->uv, &request, NULL, addr, port,
|
int retval = uv_getaddrinfo(&loop->uv, &request, NULL, addr, port,
|
||||||
&(struct addrinfo){
|
&(struct addrinfo){ .ai_family = AF_UNSPEC,
|
||||||
.ai_family = AF_UNSPEC,
|
.ai_socktype = SOCK_STREAM, });
|
||||||
.ai_socktype = SOCK_STREAM,
|
|
||||||
});
|
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
ELOG("Host lookup failed: %s", endpoint);
|
ELOG("Host lookup failed: %s", endpoint);
|
||||||
return retval;
|
return retval;
|
||||||
@ -103,10 +101,9 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb)
|
|||||||
// contain 0 in this case, unless uv_tcp_getsockname() is used first.
|
// contain 0 in this case, unless uv_tcp_getsockname() is used first.
|
||||||
uv_tcp_getsockname(&watcher->uv.tcp.handle, (struct sockaddr *)&sas,
|
uv_tcp_getsockname(&watcher->uv.tcp.handle, (struct sockaddr *)&sas,
|
||||||
&(int){ sizeof(sas) });
|
&(int){ sizeof(sas) });
|
||||||
uint16_t port = (uint16_t)(
|
uint16_t port = (uint16_t)((sas.ss_family == AF_INET)
|
||||||
(sas.ss_family == AF_INET)
|
? (STRUCT_CAST(struct sockaddr_in, &sas))->sin_port
|
||||||
? (STRUCT_CAST(struct sockaddr_in, &sas))->sin_port
|
: (STRUCT_CAST(struct sockaddr_in6, &sas))->sin6_port);
|
||||||
: (STRUCT_CAST(struct sockaddr_in6, &sas))->sin6_port);
|
|
||||||
// v:servername uses the string from watcher->addr
|
// v:servername uses the string from watcher->addr
|
||||||
size_t len = strlen(watcher->addr);
|
size_t len = strlen(watcher->addr);
|
||||||
snprintf(watcher->addr+len, sizeof(watcher->addr)-len, ":%" PRIu16,
|
snprintf(watcher->addr+len, sizeof(watcher->addr)-len, ":%" PRIu16,
|
||||||
|
@ -70,7 +70,7 @@ int get_indent_str(const char_u *ptr, int ts, bool list)
|
|||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (; *ptr; ++ptr) {
|
for (; *ptr; ptr++) {
|
||||||
// Count a tab for what it is worth.
|
// Count a tab for what it is worth.
|
||||||
if (*ptr == TAB) {
|
if (*ptr == TAB) {
|
||||||
if (!list || curwin->w_p_lcs_chars.tab1) {
|
if (!list || curwin->w_p_lcs_chars.tab1) {
|
||||||
@ -442,10 +442,9 @@ int get_breakindent_win(win_T *wp, char_u *line)
|
|||||||
static long *prev_vts = NULL; // Cached vartabs values.
|
static long *prev_vts = NULL; // Cached vartabs values.
|
||||||
int bri = 0;
|
int bri = 0;
|
||||||
// window width minus window margin space, i.e. what rests for text
|
// window width minus window margin space, i.e. what rests for text
|
||||||
const int eff_wwidth = wp->w_width_inner
|
const int eff_wwidth = wp->w_width_inner -
|
||||||
- ((wp->w_p_nu || wp->w_p_rnu)
|
((wp->w_p_nu || wp->w_p_rnu)
|
||||||
&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
|
&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) ? number_width(wp) + 1 : 0);
|
||||||
? number_width(wp) + 1 : 0);
|
|
||||||
|
|
||||||
// used cached indent, unless pointer or 'tabstop' changed
|
// used cached indent, unless pointer or 'tabstop' changed
|
||||||
if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts
|
if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts
|
||||||
@ -512,7 +511,7 @@ int inindent(int extra)
|
|||||||
char_u *ptr;
|
char_u *ptr;
|
||||||
colnr_T col;
|
colnr_T col;
|
||||||
|
|
||||||
for (col = 0, ptr = get_cursor_line_ptr(); ascii_iswhite(*ptr); ++col) {
|
for (col = 0, ptr = get_cursor_line_ptr(); ascii_iswhite(*ptr); col++) {
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,7 +629,7 @@ int get_lisp_indent(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (that = get_cursor_line_ptr(); *that != NUL; ++that) {
|
for (that = get_cursor_line_ptr(); *that != NUL; that++) {
|
||||||
if (*that == ';') {
|
if (*that == ';') {
|
||||||
while (*(that + 1) != NUL) {
|
while (*(that + 1) != NUL) {
|
||||||
that++;
|
that++;
|
||||||
|
@ -286,9 +286,7 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
|
|||||||
break;
|
break;
|
||||||
case LUA_TBOOLEAN:
|
case LUA_TBOOLEAN:
|
||||||
cur.tv->v_type = VAR_BOOL;
|
cur.tv->v_type = VAR_BOOL;
|
||||||
cur.tv->vval.v_bool = (lua_toboolean(lstate, -1)
|
cur.tv->vval.v_bool = (lua_toboolean(lstate, -1) ? kBoolVarTrue : kBoolVarFalse);
|
||||||
? kBoolVarTrue
|
|
||||||
: kBoolVarFalse);
|
|
||||||
break;
|
break;
|
||||||
case LUA_TSTRING: {
|
case LUA_TSTRING: {
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -551,8 +549,8 @@ static bool typval_conv_special = false;
|
|||||||
const MPConvStackVal mpval = kv_A(*mpstack, backref - 1); \
|
const MPConvStackVal mpval = kv_A(*mpstack, backref - 1); \
|
||||||
if (mpval.type == conv_type) { \
|
if (mpval.type == conv_type) { \
|
||||||
if (conv_type == kMPConvDict \
|
if (conv_type == kMPConvDict \
|
||||||
? (void *)mpval.data.d.dict == (void *)(val) \
|
? (void *)mpval.data.d.dict == (void *)(val) \
|
||||||
: (void *)mpval.data.l.list == (void *)(val)) { \
|
: (void *)mpval.data.l.list == (void *)(val)) { \
|
||||||
lua_pushvalue(lstate, \
|
lua_pushvalue(lstate, \
|
||||||
-((int)((kv_size(*mpstack) - backref + 1) * 2))); \
|
-((int)((kv_size(*mpstack) - backref + 1) * 2))); \
|
||||||
break; \
|
break; \
|
||||||
@ -1133,10 +1131,7 @@ Object nlua_pop_Object(lua_State *const lstate, bool ref, Error *const err)
|
|||||||
case LUA_TSTRING: {
|
case LUA_TSTRING: {
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *s = lua_tolstring(lstate, -1, &len);
|
const char *s = lua_tolstring(lstate, -1, &len);
|
||||||
*cur.obj = STRING_OBJ(((String) {
|
*cur.obj = STRING_OBJ(((String) { .data = xmemdupz(s, len), .size = len }));
|
||||||
.data = xmemdupz(s, len),
|
|
||||||
.size = len,
|
|
||||||
}));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LUA_TNUMBER: {
|
case LUA_TNUMBER: {
|
||||||
@ -1154,11 +1149,7 @@ Object nlua_pop_Object(lua_State *const lstate, bool ref, Error *const err)
|
|||||||
|
|
||||||
switch (table_props.type) {
|
switch (table_props.type) {
|
||||||
case kObjectTypeArray:
|
case kObjectTypeArray:
|
||||||
*cur.obj = ARRAY_OBJ(((Array) {
|
*cur.obj = ARRAY_OBJ(((Array) { .items = NULL, .size = 0, .capacity = 0 }));
|
||||||
.items = NULL,
|
|
||||||
.size = 0,
|
|
||||||
.capacity = 0,
|
|
||||||
}));
|
|
||||||
if (table_props.maxidx != 0) {
|
if (table_props.maxidx != 0) {
|
||||||
cur.obj->data.array.items =
|
cur.obj->data.array.items =
|
||||||
xcalloc(table_props.maxidx,
|
xcalloc(table_props.maxidx,
|
||||||
@ -1169,11 +1160,7 @@ Object nlua_pop_Object(lua_State *const lstate, bool ref, Error *const err)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kObjectTypeDictionary:
|
case kObjectTypeDictionary:
|
||||||
*cur.obj = DICTIONARY_OBJ(((Dictionary) {
|
*cur.obj = DICTIONARY_OBJ(((Dictionary) { .items = NULL, .size = 0, .capacity = 0 }));
|
||||||
.items = NULL,
|
|
||||||
.size = 0,
|
|
||||||
.capacity = 0,
|
|
||||||
}));
|
|
||||||
if (table_props.string_keys_num != 0) {
|
if (table_props.string_keys_num != 0) {
|
||||||
cur.obj->data.dictionary.items =
|
cur.obj->data.dictionary.items =
|
||||||
xcalloc(table_props.string_keys_num,
|
xcalloc(table_props.string_keys_num,
|
||||||
|
@ -720,7 +720,7 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
|
|||||||
&& dst[-1] != ':'
|
&& dst[-1] != ':'
|
||||||
#endif
|
#endif
|
||||||
&& vim_ispathsep(*tail)) {
|
&& vim_ispathsep(*tail)) {
|
||||||
++tail;
|
tail++;
|
||||||
}
|
}
|
||||||
dst += c;
|
dst += c;
|
||||||
src = tail;
|
src = tail;
|
||||||
@ -738,7 +738,7 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
|
|||||||
at_start = false;
|
at_start = false;
|
||||||
if (src[0] == '\\' && src[1] != NUL) {
|
if (src[0] == '\\' && src[1] != NUL) {
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
--dstlen;
|
dstlen--;
|
||||||
} else if ((src[0] == ' ' || src[0] == ',') && !one) {
|
} else if ((src[0] == ' ' || src[0] == ',') && !one) {
|
||||||
at_start = true;
|
at_start = true;
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
|
|||||||
|
|
||||||
if (os_has_conpty_working()) {
|
if (os_has_conpty_working()) {
|
||||||
if ((conpty_object =
|
if ((conpty_object =
|
||||||
os_conpty_init(&in_name, &out_name,
|
os_conpty_init(&in_name, &out_name, ptyproc->width, ptyproc->height)) != NULL) {
|
||||||
ptyproc->width, ptyproc->height)) != NULL) {
|
|
||||||
ptyproc->type = kConpty;
|
ptyproc->type = kConpty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1229,7 +1229,7 @@ static void read_input(DynamicBuffer *buf)
|
|||||||
dynamic_buffer_ensure(buf, buf->len + 1);
|
dynamic_buffer_ensure(buf, buf->len + 1);
|
||||||
buf->data[buf->len++] = NL;
|
buf->data[buf->len++] = NL;
|
||||||
}
|
}
|
||||||
++lnum;
|
lnum++;
|
||||||
if (lnum > curbuf->b_op_end.lnum) {
|
if (lnum > curbuf->b_op_end.lnum) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -38,17 +38,15 @@
|
|||||||
// create infinite loops
|
// create infinite loops
|
||||||
#define RBUFFER_UNTIL_EMPTY(buf, rptr, rcnt) \
|
#define RBUFFER_UNTIL_EMPTY(buf, rptr, rcnt) \
|
||||||
for (size_t rcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
|
for (size_t rcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
|
||||||
for ( /* NOLINT(readability/braces) */ \
|
for (char *rptr = rbuffer_read_ptr(buf, &rcnt); /* NOLINT(readability/braces) */ \
|
||||||
char *rptr = rbuffer_read_ptr(buf, &rcnt); \
|
buf->size; \
|
||||||
buf->size; \
|
rptr = rbuffer_read_ptr(buf, &rcnt))
|
||||||
rptr = rbuffer_read_ptr(buf, &rcnt))
|
|
||||||
|
|
||||||
#define RBUFFER_UNTIL_FULL(buf, wptr, wcnt) \
|
#define RBUFFER_UNTIL_FULL(buf, wptr, wcnt) \
|
||||||
for (size_t wcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
|
for (size_t wcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
|
||||||
for ( /* NOLINT(readability/braces) */ \
|
for (char *wptr = rbuffer_write_ptr(buf, &wcnt); /* NOLINT(readability/braces) */ \
|
||||||
char *wptr = rbuffer_write_ptr(buf, &wcnt); \
|
rbuffer_space(buf); \
|
||||||
rbuffer_space(buf); \
|
wptr = rbuffer_write_ptr(buf, &wcnt))
|
||||||
wptr = rbuffer_write_ptr(buf, &wcnt))
|
|
||||||
|
|
||||||
|
|
||||||
// Iteration
|
// Iteration
|
||||||
|
@ -8,12 +8,10 @@
|
|||||||
#include "nvim/pos.h"
|
#include "nvim/pos.h"
|
||||||
#include "nvim/types.h"
|
#include "nvim/types.h"
|
||||||
|
|
||||||
/*
|
// flags for update_screen()
|
||||||
* flags for update_screen()
|
// The higher the value, the higher the priority
|
||||||
* The higher the value, the higher the priority
|
#define VALID 10 // buffer not changed, or changes marked
|
||||||
*/
|
// with b_mod_*
|
||||||
#define VALID 10 /* buffer not changed, or changes marked
|
|
||||||
with b_mod_* */
|
|
||||||
#define INVERTED 20 // redisplay inverted part that changed
|
#define INVERTED 20 // redisplay inverted part that changed
|
||||||
#define INVERTED_ALL 25 // redisplay whole inverted part
|
#define INVERTED_ALL 25 // redisplay whole inverted part
|
||||||
#define REDRAW_TOP 30 // display first w_upd_rows screen lines
|
#define REDRAW_TOP 30 // display first w_upd_rows screen lines
|
||||||
|
@ -21,9 +21,7 @@ struct sp_syn {
|
|||||||
int16_t *cont_in_list; // cont.in group IDs, if non-zero
|
int16_t *cont_in_list; // cont.in group IDs, if non-zero
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
// Each keyword has one keyentry, which is linked in a hash list.
|
||||||
* Each keyword has one keyentry, which is linked in a hash list.
|
|
||||||
*/
|
|
||||||
typedef struct keyentry keyentry_T;
|
typedef struct keyentry keyentry_T;
|
||||||
|
|
||||||
struct keyentry {
|
struct keyentry {
|
||||||
@ -35,9 +33,7 @@ struct keyentry {
|
|||||||
char_u keyword[1]; // actually longer
|
char_u keyword[1]; // actually longer
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
// Struct used to store one state of the state stack.
|
||||||
* Struct used to store one state of the state stack.
|
|
||||||
*/
|
|
||||||
typedef struct buf_state {
|
typedef struct buf_state {
|
||||||
int bs_idx; // index of pattern
|
int bs_idx; // index of pattern
|
||||||
int bs_flags; // flags for pattern
|
int bs_flags; // flags for pattern
|
||||||
@ -46,10 +42,8 @@ typedef struct buf_state {
|
|||||||
reg_extmatch_T *bs_extmatch; // external matches from start pattern
|
reg_extmatch_T *bs_extmatch; // external matches from start pattern
|
||||||
} bufstate_T;
|
} bufstate_T;
|
||||||
|
|
||||||
/*
|
// syn_state contains the syntax state stack for the start of one line.
|
||||||
* syn_state contains the syntax state stack for the start of one line.
|
// Used by b_sst_array[].
|
||||||
* Used by b_sst_array[].
|
|
||||||
*/
|
|
||||||
struct syn_state {
|
struct syn_state {
|
||||||
synstate_T *sst_next; // next entry in used or free list
|
synstate_T *sst_next; // next entry in used or free list
|
||||||
linenr_T sst_lnum; // line number for this state
|
linenr_T sst_lnum; // line number for this state
|
||||||
@ -66,4 +60,4 @@ struct syn_state {
|
|||||||
// may have made the state invalid
|
// may have made the state invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NVIM_SYNTAX_DEFS_H
|
#endif // NVIM_SYNTAX_DEFS_H
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
#include "nvim/ex_cmds_defs.h"
|
#include "nvim/ex_cmds_defs.h"
|
||||||
#include "nvim/types.h"
|
#include "nvim/types.h"
|
||||||
|
|
||||||
/*
|
// Values for do_tag().
|
||||||
* Values for do_tag().
|
|
||||||
*/
|
|
||||||
#define DT_TAG 1 // jump to newer position or same tag again
|
#define DT_TAG 1 // jump to newer position or same tag again
|
||||||
#define DT_POP 2 // jump to older position
|
#define DT_POP 2 // jump to older position
|
||||||
#define DT_NEXT 3 // jump to next match of same tag
|
#define DT_NEXT 3 // jump to next match of same tag
|
||||||
@ -20,9 +18,7 @@
|
|||||||
#define DT_LTAG 11 // tag using location list
|
#define DT_LTAG 11 // tag using location list
|
||||||
#define DT_FREE 99 // free cached matches
|
#define DT_FREE 99 // free cached matches
|
||||||
|
|
||||||
//
|
|
||||||
// flags for find_tags().
|
// flags for find_tags().
|
||||||
//
|
|
||||||
#define TAG_HELP 1 // only search for help tags
|
#define TAG_HELP 1 // only search for help tags
|
||||||
#define TAG_NAMES 2 // only return name of tag
|
#define TAG_NAMES 2 // only return name of tag
|
||||||
#define TAG_REGEXP 4 // use tag pattern as regexp
|
#define TAG_REGEXP 4 // use tag pattern as regexp
|
||||||
@ -36,9 +32,7 @@
|
|||||||
#define TAG_MANY 300 // When finding many tags (for completion),
|
#define TAG_MANY 300 // When finding many tags (for completion),
|
||||||
// find up to this many tags
|
// find up to this many tags
|
||||||
|
|
||||||
/*
|
// Structure used for get_tagfname().
|
||||||
* Structure used for get_tagfname().
|
|
||||||
*/
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char_u *tn_tags; // value of 'tags' when starting
|
char_u *tn_tags; // value of 'tags' when starting
|
||||||
char_u *tn_np; // current position in tn_tags
|
char_u *tn_np; // current position in tn_tags
|
||||||
|
@ -33,8 +33,8 @@ struct u_entry {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct u_header {
|
struct u_header {
|
||||||
/* The following have a pointer and a number. The number is used when
|
// The following have a pointer and a number. The number is used when reading
|
||||||
* reading the undo file in u_read_undo() */
|
// the undo file in u_read_undo()
|
||||||
union {
|
union {
|
||||||
u_header_T *ptr; // pointer to next undo header in list
|
u_header_T *ptr; // pointer to next undo header in list
|
||||||
long seq;
|
long seq;
|
||||||
@ -80,4 +80,4 @@ typedef struct {
|
|||||||
FILE *bi_fp;
|
FILE *bi_fp;
|
||||||
} bufinfo_T;
|
} bufinfo_T;
|
||||||
|
|
||||||
#endif // NVIM_UNDO_DEFS_H
|
#endif // NVIM_UNDO_DEFS_H
|
||||||
|
@ -81,10 +81,8 @@ typedef struct {
|
|||||||
bool can_continuate;
|
bool can_continuate;
|
||||||
} ParserState;
|
} ParserState;
|
||||||
|
|
||||||
static inline void viml_parser_init(
|
static inline void viml_parser_init(ParserState *const ret_pstate, const ParserLineGetter get_line,
|
||||||
ParserState *const ret_pstate,
|
void *const cookie, ParserHighlight *const colors)
|
||||||
const ParserLineGetter get_line, void *const cookie,
|
|
||||||
ParserHighlight *const colors)
|
|
||||||
REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ARG(1, 2);
|
REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ARG(1, 2);
|
||||||
|
|
||||||
/// Initialize a new parser state instance
|
/// Initialize a new parser state instance
|
||||||
|
@ -12,13 +12,11 @@
|
|||||||
#define FNAME_EXP 2 // expand to path
|
#define FNAME_EXP 2 // expand to path
|
||||||
#define FNAME_HYP 4 // check for hypertext link
|
#define FNAME_HYP 4 // check for hypertext link
|
||||||
#define FNAME_INCL 8 // apply 'includeexpr'
|
#define FNAME_INCL 8 // apply 'includeexpr'
|
||||||
#define FNAME_REL 16 /* ".." and "./" are relative to the (current)
|
#define FNAME_REL 16 // ".." and "./" are relative to the (current)
|
||||||
file instead of the current directory */
|
// file instead of the current directory
|
||||||
#define FNAME_UNESC 32 // remove backslashes used for escaping
|
#define FNAME_UNESC 32 // remove backslashes used for escaping
|
||||||
|
|
||||||
/*
|
// arguments for win_split()
|
||||||
* arguments for win_split()
|
|
||||||
*/
|
|
||||||
#define WSP_ROOM 1 // require enough room
|
#define WSP_ROOM 1 // require enough room
|
||||||
#define WSP_VERT 2 // split vertically
|
#define WSP_VERT 2 // split vertically
|
||||||
#define WSP_TOP 4 // window at top-left of shell
|
#define WSP_TOP 4 // window at top-left of shell
|
||||||
@ -28,9 +26,7 @@
|
|||||||
#define WSP_ABOVE 64 // put new window above/left
|
#define WSP_ABOVE 64 // put new window above/left
|
||||||
#define WSP_NEWLOC 128 // don't copy location list
|
#define WSP_NEWLOC 128 // don't copy location list
|
||||||
|
|
||||||
/*
|
// Minimum screen size
|
||||||
* Minimum screen size
|
|
||||||
*/
|
|
||||||
#define MIN_COLUMNS 12 // minimal columns for screen
|
#define MIN_COLUMNS 12 // minimal columns for screen
|
||||||
#define MIN_LINES 2 // minimal lines for screen
|
#define MIN_LINES 2 // minimal lines for screen
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user