aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorWayne Rowcliffe <war1025@gmail.com>2015-09-17 19:30:48 -0500
committerWayne Rowcliffe <war1025@gmail.com>2015-11-11 21:19:51 -0600
commitd12f328b60f1454abfaacffdb8bae03ac7d40586 (patch)
tree35ceb59983a307a0bf0b39bd829accab49ae84a5 /src/nvim/buffer.c
parent7c32d86f7de972e859d15dd9bfbed877e773c929 (diff)
downloadrneovim-d12f328b60f1454abfaacffdb8bae03ac7d40586.tar.gz
rneovim-d12f328b60f1454abfaacffdb8bae03ac7d40586.tar.bz2
rneovim-d12f328b60f1454abfaacffdb8bae03ac7d40586.zip
Add documentation about what TABPAGENR and TABCLOSENR do
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index d5fbcdeab8..3ccef9aaf0 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3118,6 +3118,30 @@ build_stl_str_hl(
curitem++;
continue;
}
+
+ // TABPAGE pairs are used to denote a region that when clicked will
+ // either switch to or close a tab.
+ //
+ // Ex: tabline=%0Ttab\ zero%X
+ // This tabline has a TABPAGENR item with minwid `0`,
+ // which is then closed with a TABCLOSENR item.
+ // Clicking on this region with mouse enabled will switch to tab 0.
+ // Setting the minwid to a different value will switch
+ // to that tab, if it exists
+ //
+ // Ex: tabline=%1Xtab\ one%X
+ // This tabline has a TABCLOSENR item with minwid `1`,
+ // which is then closed with a TABCLOSENR item.
+ // Clicking on this region with mouse enabled will close tab 0.
+ // This is determined by the following formula:
+ // tab to close = (1 - minwid)
+ // This is because for TABPAGENR we use `minwid` = `tab number`.
+ // For TABCLOSENR we store the tab number as a negative value.
+ // Because 0 is a valid TABPAGENR value, we have to
+ // start our numbering at `-1`.
+ // So, `-1` corresponds to us wanting to close tab `0`
+ //
+ // Note: These options are only valid when creating a tabline.
if (*fmt_p == STL_TABPAGENR || *fmt_p == STL_TABCLOSENR) {
if (*fmt_p == STL_TABCLOSENR) {
if (minwid == 0) {