aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/api.txt58
-rw-r--r--src/nvim/api/private/helpers.c1
-rw-r--r--src/nvim/api/vim.c38
-rw-r--r--test/functional/ui/float_spec.lua43
4 files changed, 95 insertions, 45 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 6b3b0f7762..919417f3a0 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -1325,33 +1325,37 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
and clearing the |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. This is the default
- • "single" a single line box
- • "double" a double line box
- • "shadow" a drop shadow effect by blending
- with the background. If it is an array it
- should be an array of eight items or any
- divisor of eight. The array will specifify
- 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: [ "╔", "═" ,"╗", "║",
- "╝", "═", "╚", "║" ] if the number of chars
- are less than eight, they will be repeated.
- Thus an ASCII border could be specified as:
- [ "/", "-", "\\", "|" ] or all chars the
- same as: [ "x" ] An empty string can be used
- to turn off a specific border, for instance:
- [ "", "", "", ">", "", "", "", "<" ] will
- only make vertical borders but not
- horizontal ones. By default `FloatBorder`
- highlight is used which links to `VertSplit`
- when not defined. It could also be specified
- by character: [ {"+", "MyCorner"}, {"x",
- "MyBorder"} ]
+ • `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 specifify 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 [
+ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ]. If
+ the number of chars are less than eight,
+ they will be repeated. Thus an ASCII border
+ could be specified as [ "/", "-", "\\", "|"
+ ], or all chars the same as [ "x" ]. An
+ empty string can be used to turn off a
+ specific border, for instance, [ "", "", "",
+ ">", "", "", "", "<" ] will only make
+ vertical borders but not horizontal ones. By
+ default, `FloatBorder` highlight is used,
+ which links to `VertSplit` when not defined.
+ It could also be specified by character: [
+ {"+", "MyCorner"}, {"x", "MyBorder"} ].
• `noautocmd` : If true then no buffer-related
autocommand events such as |BufEnter|,
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 4b1c2d4baa..c7d261ba18 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -1770,6 +1770,7 @@ static void parse_border_style(Object style, FloatConfig *fconfig, Error *err)
{ "double", { "╔", "═", "╗", "║", "╝", "═", "╚", "║" }, false },
{ "single", { "┌", "─", "┐", "│", "┘", "─", "└", "│" }, false },
{ "shadow", { "", "", " ", " ", " ", " ", " ", "" }, true },
+ { "rounded", { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, false },
{ "solid", { " ", " ", " ", " ", " ", " ", " ", " " }, false },
{ NULL, { { NUL } } , false },
};
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 60535b13b3..349cc0e7da 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1437,28 +1437,30 @@ void nvim_chan_send(Integer chan, String data, Error *err)
/// end-of-buffer region is hidden by setting `eob` flag of
/// 'fillchars' to a space char, and clearing the
/// |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. This is the default
-/// - "single" a single line box
-/// - "double" a double line box
-/// - "shadow" a drop shadow effect by blending with the background.
-/// If it is an array it should be an array of eight items or any divisor of
+/// - `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 specifify 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:
-/// [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ]
-/// if the number of chars are less than eight, they will be repeated. Thus
-/// an ASCII border could be specified as:
-/// [ "/", "-", "\\", "|" ]
-/// or all chars the same as:
-/// [ "x" ]
-/// An empty string can be used to turn off a specific border, for instance:
+/// in a clockwise fashion starting with the top-left corner. As an
+/// example, the double box style could be specified as
+/// [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ].
+/// If the number of chars are less than eight, they will be repeated. Thus
+/// an ASCII border could be specified as
+/// [ "/", "-", "\\", "|" ],
+/// or all chars the same as
+/// [ "x" ].
+/// An empty string can be used to turn off a specific border, for instance,
/// [ "", "", "", ">", "", "", "", "<" ]
/// will only make vertical borders but not horizontal ones.
-/// By default `FloatBorder` highlight is used which links to `VertSplit`
+/// By default, `FloatBorder` highlight is used, which links to `VertSplit`
/// when not defined. It could also be specified by character:
-/// [ {"+", "MyCorner"}, {"x", "MyBorder"} ]
+/// [ {"+", "MyCorner"}, {"x", "MyBorder"} ].
/// - `noautocmd`: If true then no buffer-related autocommand events such as
/// |BufEnter|, |BufLeave| or |BufWinEnter| may fire from
/// calling this function.
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 3a9dcb8b01..9fa0ad08f1 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -711,6 +711,49 @@ describe('float window', function()
]]}
end
+ meths.win_set_config(win, {border="rounded"})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [2:----------------------------------------]|
+ [3:----------------------------------------]|
+ ## grid 2
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ ## grid 3
+ |
+ ## grid 5
+ {5:╭─────────╮}|
+ {5:│}{1: halloj! }{5:│}|
+ {5:│}{1: BORDAA }{5:│}|
+ {5:╰─────────╯}|
+ ]], float_pos={
+ [5] = { { id = 1002 }, "NW", 1, 2, 5, true }
+ }, win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ [5] = {win = {id = 1002}, topline = 0, botline = 2, curline = 0, curcol = 0};
+ }}
+ else
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }{5:╭─────────╮}{0: }|
+ {0:~ }{5:│}{1: halloj! }{5:│}{0: }|
+ {0:~ }{5:│}{1: BORDAA }{5:│}{0: }|
+ {0:~ }{5:╰─────────╯}{0: }|
+ |
+ ]]}
+ end
+
meths.win_set_config(win, {border="solid"})
if multigrid then
screen:expect{grid=[[