mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Add ‘eob’ option to fillchars
This option allows configuring what character is shown on the empty lines at the end of a buffer, previously hardcoded to ‘~’
This commit is contained in:
parent
463da84806
commit
a7bb63c55d
@ -2393,6 +2393,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
fold:c '·' or '-' filling 'foldtext'
|
fold:c '·' or '-' filling 'foldtext'
|
||||||
diff:c '-' deleted lines of the 'diff' option
|
diff:c '-' deleted lines of the 'diff' option
|
||||||
msgsep:c ' ' message separator 'display'
|
msgsep:c ' ' message separator 'display'
|
||||||
|
eob:c '~' empty lines at the end of a buffer
|
||||||
|
|
||||||
Any one that is omitted will fall back to the default. For "stl" and
|
Any one that is omitted will fall back to the default. For "stl" and
|
||||||
"stlnc" the space will be used when there is highlighting, '^' or '='
|
"stlnc" the space will be used when there is highlighting, '^' or '='
|
||||||
@ -2415,6 +2416,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
vert:c VertSplit |hl-VertSplit|
|
vert:c VertSplit |hl-VertSplit|
|
||||||
fold:c Folded |hl-Folded|
|
fold:c Folded |hl-Folded|
|
||||||
diff:c DiffDelete |hl-DiffDelete|
|
diff:c DiffDelete |hl-DiffDelete|
|
||||||
|
eob:c EndOfBuffer |hl-EndOfBuffer|
|
||||||
|
|
||||||
*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*
|
*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*
|
||||||
'fixendofline' 'fixeol' boolean (default on)
|
'fixendofline' 'fixeol' boolean (default on)
|
||||||
|
@ -908,6 +908,7 @@ EXTERN int fill_vert INIT(= 9474); // │
|
|||||||
EXTERN int fill_fold INIT(= 183); // ·
|
EXTERN int fill_fold INIT(= 183); // ·
|
||||||
EXTERN int fill_diff INIT(= '-');
|
EXTERN int fill_diff INIT(= '-');
|
||||||
EXTERN int fill_msgsep INIT(= ' ');
|
EXTERN int fill_msgsep INIT(= ' ');
|
||||||
|
EXTERN int fill_eob INIT(= '~');
|
||||||
|
|
||||||
/* Whether 'keymodel' contains "stopsel" and "startsel". */
|
/* Whether 'keymodel' contains "stopsel" and "startsel". */
|
||||||
EXTERN int km_stopsel INIT(= FALSE);
|
EXTERN int km_stopsel INIT(= FALSE);
|
||||||
|
@ -3386,6 +3386,7 @@ static char_u *set_chars_option(char_u **varp)
|
|||||||
{ &fill_fold, "fold" , 183 }, // ·
|
{ &fill_fold, "fold" , 183 }, // ·
|
||||||
{ &fill_diff, "diff" , '-' },
|
{ &fill_diff, "diff" , '-' },
|
||||||
{ &fill_msgsep, "msgsep", ' ' },
|
{ &fill_msgsep, "msgsep", ' ' },
|
||||||
|
{ &fill_eob, "eob", '~' },
|
||||||
};
|
};
|
||||||
static struct charstab lcstab[] = {
|
static struct charstab lcstab[] = {
|
||||||
{ &lcs_eol, "eol", NUL },
|
{ &lcs_eol, "eol", NUL },
|
||||||
|
@ -1532,9 +1532,9 @@ static void win_update(win_T *wp)
|
|||||||
} else if (dollar_vcol == -1)
|
} else if (dollar_vcol == -1)
|
||||||
wp->w_botline = lnum;
|
wp->w_botline = lnum;
|
||||||
|
|
||||||
/* make sure the rest of the screen is blank */
|
// make sure the rest of the screen is blank
|
||||||
/* put '~'s on rows that aren't part of the file. */
|
// write the 'fill_eob' character to rows that aren't part of the file.
|
||||||
win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB);
|
win_draw_end(wp, fill_eob, ' ', row, wp->w_height, HLF_EOB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the type of redrawing required, the window has been updated. */
|
/* Reset the type of redrawing required, the window has been updated. */
|
||||||
|
45
test/functional/options/fillchars_spec.lua
Normal file
45
test/functional/options/fillchars_spec.lua
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
local clear, execute = helpers.clear, helpers.execute
|
||||||
|
|
||||||
|
describe("'fillchars'", function()
|
||||||
|
local screen
|
||||||
|
|
||||||
|
before_each(function()
|
||||||
|
clear()
|
||||||
|
screen = Screen.new(25, 5)
|
||||||
|
screen:attach()
|
||||||
|
end)
|
||||||
|
|
||||||
|
after_each(function()
|
||||||
|
screen:detach()
|
||||||
|
end)
|
||||||
|
|
||||||
|
describe('"eob" flag', function()
|
||||||
|
it('renders empty lines at the end of the buffer with eob', function()
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
execute('set fillchars+=eob:\\ ')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
:set fillchars+=eob:\ |
|
||||||
|
]])
|
||||||
|
execute('set fillchars+=eob:ñ')
|
||||||
|
screen:expect([[
|
||||||
|
^ |
|
||||||
|
ñ |
|
||||||
|
ñ |
|
||||||
|
ñ |
|
||||||
|
:set fillchars+=eob:ñ |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end)
|
Loading…
Reference in New Issue
Block a user