aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorick Peterse <git@yorickpeterse.com>2021-10-07 00:31:14 +0200
committerGitHub <noreply@github.com>2021-10-06 16:31:14 -0600
commitc61a3865eea21f87ac17719ba226ad556b5a11a6 (patch)
tree6dea42e9e90c444896d24089a5c63bcef85de621 /src
parente06936125a628d8a61069f5fbce68394292db4df (diff)
downloadrneovim-c61a3865eea21f87ac17719ba226ad556b5a11a6.tar.gz
rneovim-c61a3865eea21f87ac17719ba226ad556b5a11a6.tar.bz2
rneovim-c61a3865eea21f87ac17719ba226ad556b5a11a6.zip
fix: set cursorlineopt=number in terminal mode (#15493)
When entering terminal mode, cursorlineopt is no longer entirely disabled. Instead, it's set to `number`. Doing so ensures that users using `set cursorline` combined with `set cursorlineopt=number` have consistent highlighting of the line numbers, instead of this being disabled when entering terminal mode. Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/terminal.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 6f19a9209e..07d668ba5b 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -358,11 +358,21 @@ void terminal_enter(void)
// Disable these options in terminal-mode. They are nonsense because cursor is
// placed at end of buffer to "follow" output. #11072
win_T *save_curwin = curwin;
- int save_w_p_cul = curwin->w_p_cul;
+ bool save_w_p_cul = curwin->w_p_cul;
+ char_u *save_w_p_culopt = NULL;
+ char_u save_w_p_culopt_flags = curwin->w_p_culopt_flags;
int save_w_p_cuc = curwin->w_p_cuc;
long save_w_p_so = curwin->w_p_so;
long save_w_p_siso = curwin->w_p_siso;
- curwin->w_p_cul = false;
+ if (curwin->w_p_cul && curwin->w_p_culopt_flags & CULOPT_NBR) {
+ if (strcmp((char *)curwin->w_p_culopt, "number")) {
+ save_w_p_culopt = curwin->w_p_culopt;
+ curwin->w_p_culopt = (char_u *)xstrdup("number");
+ }
+ curwin->w_p_culopt_flags = CULOPT_NBR;
+ } else {
+ curwin->w_p_cul = false;
+ }
curwin->w_p_cuc = false;
curwin->w_p_so = 0;
curwin->w_p_siso = 0;
@@ -386,9 +396,16 @@ void terminal_enter(void)
if (save_curwin == curwin) { // save_curwin may be invalid (window closed)!
curwin->w_p_cul = save_w_p_cul;
+ if (save_w_p_culopt) {
+ xfree(curwin->w_p_culopt);
+ curwin->w_p_culopt = save_w_p_culopt;
+ }
+ curwin->w_p_culopt_flags = save_w_p_culopt_flags;
curwin->w_p_cuc = save_w_p_cuc;
curwin->w_p_so = save_w_p_so;
curwin->w_p_siso = save_w_p_siso;
+ } else if (save_w_p_culopt) {
+ xfree(save_w_p_culopt);
}
// draw the unfocused cursor