aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index ed9d3ce3d8..6ecfd9ab64 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -641,7 +641,7 @@ void win_set_minimal_style(win_T *wp)
wp->w_p_scl = (char_u *)xstrdup("auto");
}
- // foldcolumn: use 'auto'
+ // foldcolumn: use '0'
if (wp->w_p_fdc[0] != '0') {
xfree(wp->w_p_fdc);
wp->w_p_fdc = (char_u *)xstrdup("0");
@@ -700,9 +700,10 @@ int win_fdccol_count(win_T *wp)
const char *fdc = (const char *)wp->w_p_fdc;
// auto:<NUM>
- if (strncmp(fdc, "auto:", 5) == 0) {
+ if (strncmp(fdc, "auto", 4) == 0) {
+ const int fdccol = fdc[4] == ':' ? fdc[5] - '0' : 1;
int needed_fdccols = getDeepestNesting(wp);
- return MIN(fdc[5] - '0', needed_fdccols);
+ return MIN(fdccol, needed_fdccols);
} else {
return fdc[0] - '0';
}
@@ -1636,6 +1637,19 @@ bool win_valid(const win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
return false;
}
+// Find window "handle" in the current tab page.
+// Return NULL if not found.
+win_T *win_find_by_handle(handle_T handle)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ if (wp->handle == handle) {
+ return wp;
+ }
+ }
+ return NULL;
+}
+
/// Check if "win" is a pointer to an existing window in any tabpage.
///
/// @param win window to check