aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/win_config.c31
-rw-r--r--src/nvim/option_vars.h1
-rw-r--r--src/nvim/options.lua20
-rw-r--r--src/nvim/optionstr.c9
4 files changed, 43 insertions, 18 deletions
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index 12bbd79dbd..31de5ca1eb 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -159,17 +159,11 @@
/// 'fillchars' to a space char, and clearing the
/// |hl-EndOfBuffer| region in 'winhighlight'.
/// - border: Style of (optional) window border. This can either be a string
-/// or an array. The string values are
-/// - "none": No border (default).
-/// - "single": A single line box.
-/// - "double": A double line box.
-/// - "rounded": Like "single", but with rounded corners ("╭" etc.).
-/// - "solid": Adds padding by a single whitespace cell.
-/// - "shadow": A drop shadow effect by blending with the background.
-/// - If it is an array, it should have a length of eight or any divisor of
-/// eight. The array will specify the eight chars building up the border
-/// in a clockwise fashion starting with the top-left corner. As an
-/// example, the double box style could be specified as:
+/// or an array. The string values are the same as those described in 'winborder'.
+/// If it is an array, it should have a length of eight or any divisor of
+/// eight. The array will specify the eight chars building up the border
+/// in a clockwise fashion starting with the top-left corner. As an
+/// example, the double box style could be specified as:
/// ```
/// [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ].
/// ```
@@ -944,11 +938,11 @@ static void parse_border_style(Object style, WinConfig *fconfig, Error *err)
char chars[8][MAX_SCHAR_SIZE];
bool shadow_color;
} defaults[] = {
- { "double", { "╔", "═", "╗", "║", "╝", "═", "╚", "║" }, false },
- { "single", { "┌", "─", "┐", "│", "┘", "─", "└", "│" }, false },
- { "shadow", { "", "", " ", " ", " ", " ", " ", "" }, true },
- { "rounded", { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, false },
- { "solid", { " ", " ", " ", " ", " ", " ", " ", " " }, false },
+ { opt_winborder_values[1], { "╔", "═", "╗", "║", "╝", "═", "╚", "║" }, false },
+ { opt_winborder_values[2], { "┌", "─", "┐", "│", "┘", "─", "└", "│" }, false },
+ { opt_winborder_values[3], { "", "", " ", " ", " ", " ", " ", "" }, true },
+ { opt_winborder_values[4], { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, false },
+ { opt_winborder_values[5], { " ", " ", " ", " ", " ", " ", " ", " " }, false },
{ NULL, { { NUL } }, false },
};
@@ -1279,12 +1273,13 @@ static bool parse_win_config(win_T *wp, Dict(win_config) *config, WinConfig *fco
}
}
- if (HAS_KEY_X(config, border)) {
+ if (HAS_KEY_X(config, border) || *p_winbd != NUL) {
if (is_split) {
api_set_error(err, kErrorTypeValidation, "non-float cannot have 'border'");
goto fail;
}
- parse_border_style(config->border, fconfig, err);
+ Object style = config->border.type != kObjectTypeNil ? config->border : CSTR_AS_OBJ(p_winbd);
+ parse_border_style(style, fconfig, err);
if (ERROR_SET(err)) {
goto fail;
}
diff --git a/src/nvim/option_vars.h b/src/nvim/option_vars.h
index 340a12a32f..a484eb8447 100644
--- a/src/nvim/option_vars.h
+++ b/src/nvim/option_vars.h
@@ -566,6 +566,7 @@ EXTERN OptInt p_wcm; ///< 'wildcharm'
EXTERN int p_wic; ///< 'wildignorecase'
EXTERN char *p_wim; ///< 'wildmode'
EXTERN int p_wmnu; ///< 'wildmenu'
+EXTERN char *p_winbd; ///< 'winborder'
EXTERN OptInt p_wh; ///< 'winheight'
EXTERN OptInt p_wmh; ///< 'winminheight'
EXTERN OptInt p_wmw; ///< 'winminwidth'
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index d150303033..3cf60513c4 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -10189,6 +10189,26 @@ local options = {
type = 'number',
},
{
+ defaults = { if_true = '' },
+ cb = 'did_set_winborder',
+ values = { '', 'double', 'single', 'shadow', 'rounded', 'solid', 'none' },
+ desc = [=[
+ Defines the default border style of floating windows. The default value
+ is empty, which is equivalent to "none". Valid values include:
+ - "none": No border.
+ - "single": A single line box.
+ - "double": A double line box.
+ - "rounded": Like "single", but with rounded corners ("╭" etc.).
+ - "solid": Adds padding by a single whitespace cell.
+ - "shadow": A drop shadow effect by blending with the background.
+ ]=],
+ full_name = 'winborder',
+ scope = { 'global' },
+ short_desc = N_('border of floating window'),
+ type = 'string',
+ varname = 'p_winbd',
+ },
+ {
abbreviation = 'wi',
cb = 'did_set_window',
defaults = {
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 3a6b4c9936..c3cdd6e804 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -2005,6 +2005,15 @@ const char *did_set_winhighlight(optset_T *args)
return NULL;
}
+/// The 'winborder' option is changed.
+const char *did_set_winborder(optset_T *args)
+{
+ if (opt_strings_flags(p_winbd, opt_winborder_values, NULL, true) != OK) {
+ return e_invarg;
+ }
+ return NULL;
+}
+
int expand_set_winhighlight(optexpand_T *args, int *numMatches, char ***matches)
{
return expand_set_opt_generic(args, get_highlight_name, numMatches, matches);