Skip to content

Commit

Permalink
Merge #7708 from ZyX-I/hide-container-impl
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmk committed Dec 23, 2017
2 parents ec86f42 + 5cb7a70 commit dee78a4
Show file tree
Hide file tree
Showing 28 changed files with 1,579 additions and 1,038 deletions.
6 changes: 5 additions & 1 deletion runtime/doc/eval.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5493,7 +5493,7 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
sets buffer line boundaries to redraw screen. It is supposed
to be used when fast match additions and deletions are
required, for example to highlight matching parentheses.

*E5030* *E5031*
The list {pos} can contain one of these items:
- A number. This whole line will be highlighted. The first
line has number 1.
Expand All @@ -5507,6 +5507,10 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
- A list with three numbers, e.g., [23, 11, 3]. As above, but
the third number gives the length of the highlight in bytes.

Entries with zero and negative line numbers are silently
ignored, as well as entries with negative column numbers and
lengths.

The maximum number of positions is 8.

Example: >
Expand Down
18 changes: 15 additions & 3 deletions src/clint.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
'runtime/printf',
'runtime/printf_format',
'runtime/threadsafe_fn',
'runtime/deprecated',
'syntax/parenthesis',
'whitespace/alignment',
'whitespace/blank_line',
Expand Down Expand Up @@ -2123,8 +2124,10 @@ def CheckExpressionAlignment(filename, clean_lines, linenum, error, startpos=0):
+ (level_starts[depth][2] == '{')):
if depth not in ignore_error_levels:
error(filename, linenum, 'whitespace/alignment', 2,
'Inner expression should be aligned '
'as opening brace + 1 (+ 2 in case of {)')
('Inner expression should be aligned '
'as opening brace + 1 (+ 2 in case of {{). '
'Relevant opening is on line {0!r}').format(
level_starts[depth][3]))
prev_line_start = pos
elif brace == 'e':
pass
Expand All @@ -2141,7 +2144,8 @@ def CheckExpressionAlignment(filename, clean_lines, linenum, error, startpos=0):
ignore_error_levels.add(depth)
line_ended_with_opening = (
pos == len(line) - 2 * (line.endswith(' \\')) - 1)
level_starts[depth] = (pos, line_ended_with_opening, brace)
level_starts[depth] = (pos, line_ended_with_opening, brace,
linenum)
if line_ended_with_opening:
depth_line_starts[depth] = (prev_line_start, brace)
else:
Expand Down Expand Up @@ -3200,6 +3204,14 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
if match:
error(filename, linenum, 'runtime/printf', 4,
'Use xstrlcat or snprintf instead of %s' % match.group(1))
if not Search(r'eval/typval\.[ch]$', filename):
match = Search(r'(?:\.|->)'
r'(?:lv_(?:first|last|refcount|len|watch|idx(?:_item)?'
r'|copylist|lock)'
r'|li_(?:next|prev|tv))\b', line)
if match:
error(filename, linenum, 'runtime/deprecated', 4,
'Accessing list_T internals directly is prohibited')

# Check for suspicious usage of "if" like
# } if (a == b) {
Expand Down
4 changes: 2 additions & 2 deletions src/nvim/api/private/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
Object item = obj.data.array.items[i];
listitem_T *li = tv_list_item_alloc();

if (!object_to_vim(item, &li->li_tv, err)) {
if (!object_to_vim(item, TV_LIST_ITEM_TV(li), err)) {
// cleanup
tv_list_item_free(li);
tv_list_free(list);
Expand All @@ -798,7 +798,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)

tv_list_append(list, li);
}
list->lv_refcount++;
tv_list_ref(list);

tv->v_type = VAR_LIST;
tv->vval.v_list = list;
Expand Down
4 changes: 2 additions & 2 deletions src/nvim/api/vim.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,9 @@ typedef struct {
Object *ret_node_p;
} ExprASTConvStackItem;

///@cond DOXYGEN_NOT_A_FUNCTION
/// @cond DOXYGEN_NOT_A_FUNCTION
typedef kvec_withinit_t(ExprASTConvStackItem, 16) ExprASTConvStack;
///@endcond
/// @endcond

/// Parse a VimL expression
///
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ static void on_channel_event(void **args)
argv[1].v_type = VAR_LIST;
argv[1].v_lock = VAR_UNLOCKED;
argv[1].vval.v_list = ev->received;
argv[1].vval.v_list->lv_refcount++;
tv_list_ref(argv[1].vval.v_list);
} else {
argv[1].v_type = VAR_NUMBER;
argv[1].v_lock = VAR_UNLOCKED;
Expand Down
16 changes: 8 additions & 8 deletions src/nvim/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3536,19 +3536,19 @@ expand_by_function (
/*
* Add completions from a list.
*/
static void ins_compl_add_list(list_T *list)
static void ins_compl_add_list(list_T *const list)
{
listitem_T *li;
int dir = compl_direction;

/* Go through the List with matches and add each of them. */
for (li = list->lv_first; li != NULL; li = li->li_next) {
if (ins_compl_add_tv(&li->li_tv, dir) == OK)
/* if dir was BACKWARD then honor it just once */
// Go through the List with matches and add each of them.
TV_LIST_ITER(list, li, {
if (ins_compl_add_tv(TV_LIST_ITEM_TV(li), dir) == OK) {
// If dir was BACKWARD then honor it just once.
dir = FORWARD;
else if (did_emsg)
} else if (did_emsg) {
break;
}
}
});
}

/*
Expand Down
Loading

0 comments on commit dee78a4

Please sign in to comment.