aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2015-12-20 09:00:37 +0300
committerZyX <kp-pav@yandex.ru>2016-02-01 21:40:06 +0300
commit64038bf4e26c57c156db921f60f3cb7bf41ac1fa (patch)
tree55af52b21e620423af3254a37e01c8afb361faeb /src/nvim/buffer.c
parentef662498b1ea1aca430624e3fc0d304494282c72 (diff)
downloadrneovim-64038bf4e26c57c156db921f60f3cb7bf41ac1fa.tar.gz
rneovim-64038bf4e26c57c156db921f60f3cb7bf41ac1fa.tar.bz2
rneovim-64038bf4e26c57c156db921f60f3cb7bf41ac1fa.zip
tabline: Switch to functions, handle different click types
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index f8413c32fa..34e24712cd 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2846,7 +2846,7 @@ int build_stl_str_hl(
struct stl_item {
// Where the item starts in the status line output buffer
char_u *start;
- // Command to run for ClickCmd items.
+ // Function to run for ClickFunc items.
char *cmd;
// The minimum width of the item
int minwid;
@@ -2859,7 +2859,7 @@ int build_stl_str_hl(
Middle,
Highlight,
TabPage,
- ClickCmd,
+ ClickFunc,
Trunc
} type;
} item[STL_MAX_ITEM];
@@ -3167,17 +3167,19 @@ int build_stl_str_hl(
continue;
}
- if (*fmt_p == STL_CLICK_CMD) {
+ if (*fmt_p == STL_CLICK_FUNC) {
+ fmt_p++;
char *t = (char *) fmt_p;
- while (*fmt_p != ']' && *fmt_p) {
+ while (*fmt_p != STL_CLICK_FUNC && *fmt_p) {
fmt_p++;
}
- if (*fmt_p != ']') {
+ if (*fmt_p != STL_CLICK_FUNC) {
break;
}
- item[curitem].type = ClickCmd;
+ item[curitem].type = ClickFunc;
item[curitem].start = out_p;
- item[curitem].cmd = xmemdupz(t + 1, (size_t) (((char *) fmt_p - t) - 1));
+ item[curitem].cmd = xmemdupz(t, (size_t) (((char *) fmt_p - t)));
+ item[curitem].minwid = minwid;
fmt_p++;
curitem++;
continue;
@@ -3858,20 +3860,20 @@ int build_stl_str_hl(
}
cur_tab_rec->def.tabnr = tabnr;
}
- cur_tab_rec->def.cmd = NULL;
+ cur_tab_rec->def.func = NULL;
cur_tab_rec++;
- } else if (item[l].type == ClickCmd) {
+ } else if (item[l].type == ClickFunc) {
cur_tab_rec->start = (char *) item[l].start;
- cur_tab_rec->def.type = kStlClickCmd;
- cur_tab_rec->def.tabnr = 0;
- cur_tab_rec->def.cmd = item[l].cmd;
+ cur_tab_rec->def.type = kStlClickFuncRun;
+ cur_tab_rec->def.tabnr = item[l].minwid;
+ cur_tab_rec->def.func = item[l].cmd;
cur_tab_rec++;
}
}
cur_tab_rec->start = NULL;
cur_tab_rec->def.type = kStlClickDisabled;
cur_tab_rec->def.tabnr = 0;
- cur_tab_rec->def.cmd = NULL;
+ cur_tab_rec->def.func = NULL;
}
return width;