fix lints

This commit is contained in:
Thomas Vigouroux
2020-06-29 18:34:45 +02:00
committed by Björn Linse
parent 9437327d5e
commit 82fb6a8818
6 changed files with 38 additions and 34 deletions

View File

@@ -282,7 +282,8 @@ void buf_updates_send_changes(buf_T *buf,
kv_size(buf->update_callbacks) = j; kv_size(buf->update_callbacks) = j;
} }
void buf_updates_send_splice(buf_T *buf, void buf_updates_send_splice(
buf_T *buf,
int start_row, colnr_T start_col, bcount_t start_byte, int start_row, colnr_T start_col, bcount_t start_byte,
int old_row, colnr_T old_col, bcount_t old_byte, int old_row, colnr_T old_col, bcount_t old_byte,
int new_row, colnr_T new_col, bcount_t new_byte) int new_row, colnr_T new_col, bcount_t new_byte)

View File

@@ -1611,7 +1611,7 @@ int open_line(
} }
ml_replace(curwin->w_cursor.lnum, p_extra, true); ml_replace(curwin->w_cursor.lnum, p_extra, true);
changed_bytes(curwin->w_cursor.lnum, 0); changed_bytes(curwin->w_cursor.lnum, 0);
// TODO: extmark_splice_cols here?? // TODO(vigoux): extmark_splice_cols here??
curwin->w_cursor.lnum--; curwin->w_cursor.lnum--;
did_append = false; did_append = false;
} }

View File

@@ -540,7 +540,7 @@ void extmark_adjust(buf_T *buf,
int old_row, new_row; int old_row, new_row;
if (amount == MAXLNUM) { if (amount == MAXLNUM) {
old_row = (int)(line2 - line1+1); old_row = (int)(line2 - line1+1);
// TODO: ej kasta? // TODO(bfredl): ej kasta?
old_byte = (bcount_t)buf->deleted_bytes2; old_byte = (bcount_t)buf->deleted_bytes2;
new_row = (int)(amount_after + old_row); new_row = (int)(amount_after + old_row);
@@ -553,7 +553,8 @@ void extmark_adjust(buf_T *buf,
new_row = (int)amount; new_row = (int)amount;
} }
if (new_row > 0) { if (new_row > 0) {
new_byte = ml_find_line_or_offset(buf, line1+new_row, NULL, true)-start_byte; new_byte = ml_find_line_or_offset(buf, line1+new_row, NULL, true)
- start_byte;
} }
extmark_splice_impl(buf, extmark_splice_impl(buf,
(int)line1-1, 0, start_byte, (int)line1-1, 0, start_byte,
@@ -668,7 +669,8 @@ void extmark_splice_cols(buf_T *buf,
0, new_col, new_col, undo); 0, new_col, new_col, undo);
} }
void extmark_move_region(buf_T *buf, void extmark_move_region(
buf_T *buf,
int start_row, colnr_T start_col, bcount_t start_byte, int start_row, colnr_T start_col, bcount_t start_byte,
int extent_row, colnr_T extent_col, bcount_t extent_byte, int extent_row, colnr_T extent_col, bcount_t extent_byte,
int new_row, colnr_T new_col, bcount_t new_byte, int new_row, colnr_T new_col, bcount_t new_byte,

View File

@@ -298,8 +298,10 @@ int set_indent(int size, int flags)
ml_replace(curwin->w_cursor.lnum, newline, false); ml_replace(curwin->w_cursor.lnum, newline, false);
if (!(flags & SIN_NOMARK)) { if (!(flags & SIN_NOMARK)) {
extmark_splice_cols(curbuf, extmark_splice_cols(curbuf,
(int)curwin->w_cursor.lnum-1, skipcols, (int)curwin->w_cursor.lnum-1,
(int)(p-oldline) - skipcols, (int)(s-newline) - skipcols, skipcols,
(int)(p-oldline) - skipcols,
(int)(s-newline) - skipcols,
kExtmarkUndo); kExtmarkUndo);
} }

View File

@@ -257,11 +257,11 @@ int ml_open(buf_T *buf)
/* /*
* init fields in memline struct * init fields in memline struct
*/ */
buf->b_ml.ml_stack_size = 0; /* no stack yet */ buf->b_ml.ml_stack_size = 0; // no stack yet
buf->b_ml.ml_stack = NULL; /* no stack yet */ buf->b_ml.ml_stack = NULL; // no stack yet
buf->b_ml.ml_stack_top = 0; /* nothing in the stack */ buf->b_ml.ml_stack_top = 0; // nothing in the stack
buf->b_ml.ml_locked = NULL; /* no cached block */ buf->b_ml.ml_locked = NULL; // no cached block
buf->b_ml.ml_line_lnum = 0; /* no cached line */ buf->b_ml.ml_line_lnum = 0; // no cached line
buf->b_ml.ml_line_offset = 0; buf->b_ml.ml_line_offset = 0;
buf->b_ml.ml_chunksize = NULL; buf->b_ml.ml_chunksize = NULL;
@@ -832,12 +832,12 @@ void ml_recover(bool checkext)
/* /*
* init fields in memline struct * init fields in memline struct
*/ */
buf->b_ml.ml_stack_size = 0; /* no stack yet */ buf->b_ml.ml_stack_size = 0; // no stack yet
buf->b_ml.ml_stack = NULL; /* no stack yet */ buf->b_ml.ml_stack = NULL; // no stack yet
buf->b_ml.ml_stack_top = 0; /* nothing in the stack */ buf->b_ml.ml_stack_top = 0; // nothing in the stack
buf->b_ml.ml_line_lnum = 0; /* no cached line */ buf->b_ml.ml_line_lnum = 0; // no cached line
buf->b_ml.ml_line_offset = 0; buf->b_ml.ml_line_offset = 0;
buf->b_ml.ml_locked = NULL; /* no locked block */ buf->b_ml.ml_locked = NULL; // no locked block
buf->b_ml.ml_flags = 0; buf->b_ml.ml_flags = 0;
/* /*

View File

@@ -255,15 +255,14 @@ describe('lua buffer event callbacks: on_bytes', function()
-- nvim_buf_get_offset forces a flush of the memline). To be safe run the -- nvim_buf_get_offset forces a flush of the memline). To be safe run the
-- test both ways. -- test both ways.
local function check(verify) local function check(verify)
local lastsize
meths.buf_set_lines(0, 0, -1, true, origlines) meths.buf_set_lines(0, 0, -1, true, origlines)
local shadow = deepcopy(origlines) local shadow = deepcopy(origlines)
local shadowbytes = table.concat(shadow, '\n') .. '\n' local shadowbytes = table.concat(shadow, '\n') .. '\n'
if verify then if verify then
lastsize = meths.buf_get_offset(0, meths.buf_line_count(0)) meths.buf_get_offset(0, meths.buf_line_count(0))
end end
exec_lua("return test_register(...)", 0, "test1",false,utf_sizes) exec_lua("return test_register(...)", 0, "test1",false, nil)
local tick = meths.buf_get_changedtick(0) meths.buf_get_changedtick(0)
local verify_name = "test1" local verify_name = "test1"
local function check_events(expected) local function check_events(expected)
@@ -272,7 +271,7 @@ describe('lua buffer event callbacks: on_bytes', function()
if verify then if verify then
for _, event in ipairs(events) do for _, event in ipairs(events) do
if event[1] == verify_name and event[2] == "bytes" then if event[1] == verify_name and event[2] == "bytes" then
local _, _, buf, tick, start_row, start_col, start_byte, old_row, old_col, old_byte, new_row, new_col, new_byte = unpack(event) local _, _, _, _, _, _, start_byte, _, _, old_byte, _, _, new_byte = unpack(event)
local before = string.sub(shadowbytes, 1, start_byte) local before = string.sub(shadowbytes, 1, start_byte)
-- no text in the tests will contain 0xff bytes (invalid UTF-8) -- no text in the tests will contain 0xff bytes (invalid UTF-8)
-- so we can use it as marker for unknown bytes -- so we can use it as marker for unknown bytes