aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-08-28 13:32:48 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2017-06-24 11:09:10 +0200
commit7873660e1ebbb6350609f4200296fc2ac4bf3035 (patch)
treef8f2cb3ecf7e44ff0e537920606a5c516dbbb1a4 /src
parent28a549d597a286330ba87ff4fffe1e2d09e0f611 (diff)
downloadrneovim-7873660e1ebbb6350609f4200296fc2ac4bf3035.tar.gz
rneovim-7873660e1ebbb6350609f4200296fc2ac4bf3035.tar.bz2
rneovim-7873660e1ebbb6350609f4200296fc2ac4bf3035.zip
bufhl: some style cleanup
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c21
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/bufhl_defs.h17
-rw-r--r--src/nvim/screen.c2
4 files changed, 21 insertions, 21 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 39014d903a..ebb38fe709 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -5150,7 +5150,8 @@ void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_a
/// @param line the linenumber to lookup
/// @param put if true, put a new line when not found
/// if false, return NULL when not found
-BufhlLine *bufhl_tree_ref(kbtree_t(bufhl) *b, linenr_T line, bool put) {
+BufhlLine *bufhl_tree_ref(BufhlInfo *b, linenr_T line, bool put)
+{
BufhlLine t = BUFHLLINE_INIT(line);
// kp_put() only works if key is absent, try get first
@@ -5207,7 +5208,7 @@ int bufhl_add_hl(buf_T *buf,
BufhlLine *lineinfo = bufhl_tree_ref(&buf->b_bufhl_info, lnum, true);
- bufhl_hl_item_T *hlentry = kv_pushp(lineinfo->items);
+ BufhlItem *hlentry = kv_pushp(lineinfo->items);
hlentry->src_id = src_id;
hlentry->hl_id = hl_id;
hlentry->start = col_start;
@@ -5279,16 +5280,16 @@ static BufhlLineStatus bufhl_clear_line(BufhlLine *lineinfo, int src_id,
if (src_id < 0) {
kv_size(lineinfo->items) = 0;
} else {
- size_t newind = 0;
+ size_t newidx = 0;
for (size_t i = 0; i < kv_size(lineinfo->items); i++) {
if (kv_A(lineinfo->items, i).src_id != src_id) {
- if (i != newind) {
- kv_A(lineinfo->items, newind) = kv_A(lineinfo->items, i);
+ if (i != newidx) {
+ kv_A(lineinfo->items, newidx) = kv_A(lineinfo->items, i);
}
- newind++;
+ newidx++;
}
}
- kv_size(lineinfo->items) = newind;
+ kv_size(lineinfo->items) = newidx;
}
if (kv_size(lineinfo->items) == 0) {
@@ -5349,7 +5350,7 @@ void bufhl_mark_adjust(buf_T* buf,
/// @param lnum The line number
/// @param[out] info The highligts for the line
/// @return true if there was highlights to display
-bool bufhl_start_line(buf_T *buf, linenr_T lnum, bufhl_lineinfo_T *info)
+bool bufhl_start_line(buf_T *buf, linenr_T lnum, BufhlLineInfo *info)
{
BufhlLine *lineinfo = bufhl_tree_ref(&buf->b_bufhl_info, lnum, false);
if (!lineinfo) {
@@ -5370,14 +5371,14 @@ bool bufhl_start_line(buf_T *buf, linenr_T lnum, bufhl_lineinfo_T *info)
/// @param info The info returned by bufhl_start_line
/// @param col The column to get the attr for
/// @return The highilight attr to display at the column
-int bufhl_get_attr(bufhl_lineinfo_T *info, colnr_T col) {
+int bufhl_get_attr(BufhlLineInfo *info, colnr_T col) {
if (col <= info->valid_to) {
return info->current;
}
int attr = 0;
info->valid_to = MAXCOL;
for (size_t i = 0; i < kv_size(info->entries); i++) {
- bufhl_hl_item_T entry = kv_A(info->entries, i);
+ BufhlItem entry = kv_A(info->entries, i);
if (entry.start <= col && col <= entry.stop) {
int entry_attr = syn_id2attr(entry.hl_id);
attr = hl_combine_attr(attr, entry_attr);
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index c027dc4512..8e928bce62 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -760,7 +760,7 @@ struct file_buffer {
int b_mapped_ctrl_c; // modes where CTRL-C is mapped
- bufhl_info_T b_bufhl_info; // buffer stored highlights
+ BufhlInfo b_bufhl_info; // buffer stored highlights
};
/*
diff --git a/src/nvim/bufhl_defs.h b/src/nvim/bufhl_defs.h
index ddf048dd82..24bd6b7f29 100644
--- a/src/nvim/bufhl_defs.h
+++ b/src/nvim/bufhl_defs.h
@@ -4,32 +4,31 @@
#include "nvim/pos.h"
#include "nvim/lib/kvec.h"
#include "nvim/lib/kbtree.h"
+
// bufhl: buffer specific highlighting
-struct bufhl_hl_item
-{
+typedef struct {
int src_id;
int hl_id; // highlight group
colnr_T start; // first column to highlight
colnr_T stop; // last column to highlight
-};
-typedef struct bufhl_hl_item bufhl_hl_item_T;
+} BufhlItem;
-typedef kvec_t(struct bufhl_hl_item) bufhl_vec_T;
+typedef kvec_t(BufhlItem) BufhlItemVec;
typedef struct {
linenr_T line;
- bufhl_vec_T items;
+ BufhlItemVec items;
} BufhlLine;
#define BUFHLLINE_INIT(l) { l, KV_INITIAL_VALUE }
typedef struct {
- bufhl_vec_T entries;
+ BufhlItemVec entries;
int current;
colnr_T valid_to;
-} bufhl_lineinfo_T;
+} BufhlLineInfo;
#define BUFHL_CMP(a, b) ((int)(((a)->line - (b)->line)))
KBTREE_INIT(bufhl, BufhlLine *, BUFHL_CMP, 10)
-typedef kbtree_t(bufhl) bufhl_info_T;
+typedef kbtree_t(bufhl) BufhlInfo;
#endif // NVIM_BUFHL_DEFS_H
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 3ff2a94a20..2f7fa8724f 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2210,7 +2210,7 @@ win_line (
bool search_attr_from_match = false; // if search_attr is from :match
bool has_bufhl = false; // this buffer has highlight matches
int bufhl_attr = 0; // attributes desired by bufhl
- bufhl_lineinfo_T bufhl_info; // bufhl data for this line
+ BufhlLineInfo bufhl_info; // bufhl data for this line
/* draw_state: items that are drawn in sequence: */
#define WL_START 0 /* nothing done yet */