aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis B <bluz71@users.noreply.github.com>2019-11-22 20:55:04 +1100
committerBjΓΆrn Linse <bjorn.linse@gmail.com>2019-11-22 10:55:04 +0100
commitd5f14b8372b3c8d441187eea659156534cb4c9ba (patch)
treea7094508258e1adc454f0045fd65ed14665bad7b
parentcc5487e32f6fc6d0034634a1f9e736968afb4450 (diff)
downloadrneovim-d5f14b8372b3c8d441187eea659156534cb4c9ba.tar.gz
rneovim-d5f14b8372b3c8d441187eea659156534cb4c9ba.tar.bz2
rneovim-d5f14b8372b3c8d441187eea659156534cb4c9ba.zip
Clear 'cc' in nvim_open_win 'minimal' style #11361 (#11427)
* Clear 'cc' in nvim_open_win 'minimal' style #11361 Add 'colorcolumn' to the list of options that should be cleared when creating a 'minimal'-style floating window.
-rw-r--r--runtime/doc/api.txt9
-rw-r--r--src/nvim/api/vim.c7
-rw-r--r--src/nvim/window.c6
-rw-r--r--test/functional/ui/float_spec.lua38
4 files changed, 35 insertions, 25 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 57a72e6173..f97795b0ee 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -933,10 +933,11 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
'number', 'relativenumber', 'cursorline',
'cursorcolumn', 'foldcolumn', 'spell' and
'list' options. 'signcolumn' is changed to
- `auto` . The end-of-buffer region is hidden
- by setting `eob` flag of 'fillchars' to a
- space char, and clearing the |EndOfBuffer|
- region in 'winhighlight'.
+ `auto` and 'colorcolumn' is cleared. The
+ end-of-buffer region is hidden by setting
+ `eob` flag of 'fillchars' to a space char, and
+ clearing the |EndOfBuffer| region in
+ 'winhighlight'.
Return: ~
Window handle, or 0 on error
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 10f7dd1a7b..3535bc3186 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1074,9 +1074,10 @@ fail:
/// float where the text should not be edited. Disables
/// 'number', 'relativenumber', 'cursorline', 'cursorcolumn',
/// 'foldcolumn', 'spell' and 'list' options. 'signcolumn'
-/// is changed to `auto`. The end-of-buffer region is hidden
-/// by setting `eob` flag of 'fillchars' to a space char,
-/// and clearing the |EndOfBuffer| region in 'winhighlight'.
+/// is changed to `auto` and 'colorcolumn' is cleared. The
+/// end-of-buffer region is hidden by setting `eob` flag of
+/// 'fillchars' to a space char, and clearing the
+/// |EndOfBuffer| region in 'winhighlight'.
/// @param[out] err Error details, if any
///
/// @return Window handle, or 0 on error
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2a7578e33c..dee36df433 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -633,6 +633,12 @@ void win_set_minimal_style(win_T *wp)
xfree(wp->w_p_scl);
wp->w_p_scl = (char_u *)xstrdup("auto");
}
+
+ // colorcolumn: cleared
+ if (wp->w_p_cc != NULL && *wp->w_p_cc != NUL) {
+ xfree(wp->w_p_cc);
+ wp->w_p_cc = (char_u *)xstrdup("");
+ }
}
void win_config_float(win_T *wp, FloatConfig fconfig)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index dbaf6f802b..8ddb2e90a6 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -39,6 +39,7 @@ describe('floating windows', function()
[19] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
[20] = {bold = true, foreground = Screen.colors.Brown},
[21] = {background = Screen.colors.Gray90},
+ [22] = {background = Screen.colors.LightRed},
}
it('behavior', function()
@@ -398,6 +399,7 @@ describe('floating windows', function()
it("can use 'minimal' style", function()
command('set number')
command('set signcolumn=yes')
+ command('set colorcolumn=1')
command('set cursorline')
command('set foldcolumn=1')
command('hi NormalFloat guibg=#333333')
@@ -414,9 +416,9 @@ describe('floating windows', function()
[2:----------------------------------------]|
[3:----------------------------------------]|
## grid 2
- {19: }{20: 1 }{21:^x }|
- {19: }{14: 2 }y |
- {19: }{14: 3 } |
+ {19: }{20: 1 }{22:^x}{21: }|
+ {19: }{14: 2 }{22:y} |
+ {19: }{14: 3 }{22: } |
{0:~ }|
{0:~ }|
{0:~ }|
@@ -430,9 +432,9 @@ describe('floating windows', function()
]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
else
screen:expect{grid=[[
- {19: }{20: 1 }{21:^x }|
- {19: }{14: 2 }y |
- {19: }{14: 3 } {15:x } |
+ {19: }{20: 1 }{22:^x}{21: }|
+ {19: }{14: 2 }{22:y} |
+ {19: }{14: 3 }{22: } {15:x } |
{0:~ }{15:y }{0: }|
{0:~ }{15: }{0: }|
{0:~ }{15: }{0: }|
@@ -454,9 +456,9 @@ describe('floating windows', function()
[2:----------------------------------------]|
[3:----------------------------------------]|
## grid 2
- {19: }{17:πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„}{20: 1 }{21:^x }|
- {19: }{14: 2 }y |
- {19: }{14: 3 } |
+ {19: }{17:πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„}{20: 1 }{22:^x}{21: }|
+ {19: }{14: 2 }{22:y} |
+ {19: }{14: 3 }{22: } |
{0:~ }|
{0:~ }|
{0:~ }|
@@ -471,9 +473,9 @@ describe('floating windows', function()
else
screen:expect([[
- {19: }{17:πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„}{20: 1 }{21:^x }|
- {19: }{14: 2 }y |
- {19: }{14: 3 } {17:πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„}{15:x } |
+ {19: }{17:πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„}{20: 1 }{22:^x}{21: }|
+ {19: }{14: 2 }{22:y} |
+ {19: }{14: 3 }{22: } {17:πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„πŒ’Μ€ΜΜ‚ΜƒΜ…Μ„}{15:x } |
{0:~ }{19: }{15:y }{0: }|
{0:~ }{19: }{15: }{0: }|
{0:~ }{15: }{0: }|
@@ -495,9 +497,9 @@ describe('floating windows', function()
[2:----------------------------------------]|
[3:----------------------------------------]|
## grid 2
- {19: }{20: 1 }{21:^x }|
- {19: }{14: 2 }y |
- {19: }{14: 3 } |
+ {19: }{20: 1 }{22:^x}{21: }|
+ {19: }{14: 2 }{22:y} |
+ {19: }{14: 3 }{22: } |
{0:~ }|
{0:~ }|
{0:~ }|
@@ -511,9 +513,9 @@ describe('floating windows', function()
]], float_pos={[4] = {{id = 1001}, "NW", 1, 4, 10, true}}}
else
screen:expect([[
- {19: }{20: 1 }{21:^x }|
- {19: }{14: 2 }y |
- {19: }{14: 3 } {15: } |
+ {19: }{20: 1 }{22:^x}{21: }|
+ {19: }{14: 2 }{22:y} |
+ {19: }{14: 3 }{22: } {15: } |
{0:~ }{15: }{0: }|
{0:~ }{15: }{0: }|
{0:~ }{15: }{0: }|