aligrudi / neatvi

A small vi/ex editor for editing UTF-8 text
http://litcave.rudi.ir/
301 stars 25 forks source link

Keep status line background white when nohl is set #72

Open lobre opened 9 months ago

lobre commented 9 months ago

When you have syntax highlighting disabled with set nohl, it is really hard to distinguish the separation between splits, because the statusline background (which is white by default) is removed.

I understand that setting set nohl means removing colors, but I would argue that keeping at least this white background on the statusline would give a better experience.

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

When you have syntax highlighting disabled with set nohl, it is really hard to distinguish the separation between splits, because the statusline background (which is white by default) is removed.

I understand that setting set nohl means removing colors, but I would argue that keeping at least this white background on the statusline would give a better experience.

OK. Now the status line is highlighted, even if nohl is set.

Ali
lobre commented 8 months ago

Thank you this is cleaner in terms of separation.

However, not sure how I feel about this because while the background is white (as desired), the line foreground is still "colored". Seeing the code and the change you made, I am not sure it is as trivial as I thought.

But ideally, when I set nohl, I would like to avoid "colors". So I was thinking that without hl, the background would keep white (to continue having this clean separation), but the foreground would stay all-black.

Do you know if this is easily doable without too much refactoring?

Thank you again, your small vi editor is really interesting in terms of codebase and outcome. It is a pleasure to hack around! Great project to get inspired.

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Thank you this is cleaner in terms of separation.

However, not sure how I feel about this because while the background is white (as desired), the line foreground is still "colored". Seeing the code and the change you made, I am not sure it is as trivial as I thought.

But ideally, when I set nohl, I would like to avoid "colors". So I was thinking that without hl, the background would keep white (to continue having this clean separation), but the foreground would stay all-black.

Do you know if this is easily doable without too much refactoring?

You may edit conf.h for that. See the "---" and "-ex" patterns in highlights array.

Ali
lobre commented 8 months ago

You may edit conf.h for that. See the "---" and "-ex" patterns in highlights array.

Yeah, I saw that and understand overall that neatvi was meant to be hacked directly in the source code. And this is nice in some way to have such a simple codebase so that this is possible.

However, in the long run, I am not sure I am in favor of maintaining my fork or patches of neatvi. I see neatvi is already packaged here and there (for instance in Alpine apk). And I just enjoy using tools are they are, without having to clone and rebuild my tools when possible.

So while I understand that it is doable (and in a simple way), I think I will prefer staying with the default experience even if it means I have some small personal inconsistencies. And it is also why I am trying to get a grasp of neatvi and try to bring feedback so that I can hopefully contribute to having it evolve into a good enough default xp.

And this is also why I am not really into syntax highlighting. For each new language, this will require tweaking. And to me, the burden of creating and maintaining it is not worth it. I prefer to disable it and learn to not bother not having it. I guess it pays in the long run.

I saw in other issues also the resistance to creating a configuration file. This is great also in some way. It keeps the soft simple and encourages hacking. But same, if I could avoid having to rebuild and just drop a small configuration file in my dotfiles, I see this as a good tradeoff.

Anyway, to come back to the issue, I still find it weird that even saying: I set nohl so I don't want syntax highlighting, I still have this status line highlighted (ツ)_/¯

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Anyway, to come back to the issue, I still find it weird that even saying: I set nohl so I don't want syntax highlighting, I still have this status line highlighted (ツ)_/¯

Agreed. Now the status line is in the reverse colour mode when nohl is set.

Ali
lobre commented 8 months ago

When I do have colors enabled (set hl), the statusline background (which is white) is very close to the foreground of ex commands.

image

While when I do (^g), the filename is colored with darker variants, so it is fine.

image

I know colors can be changed in conf.h, but I think the default color for this foreground might not be ideal, especially because I use a terminal palette which is pretty standard (close to default 16 ansi colors). So I guess I might not be the only one having the pb.

image

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

When I do have colors enabled (set hl), the statusline background (which is white) is very close to the foreground of ex commands.

image

While when I do (^g), the filename is colored with darker variants, so it is fine.

image

I know colors can be changed in conf.h, but I think the default color for this foreground might not be ideal, especially because I use a terminal palette which is pretty standard (close to default 16 ansi colors). So I guess I might not be the only one having the pb.

image

For light background, which I use, there is no issue because the default forground colour is darker. Specifying the foreground colour probably fixes the issue. How about this?

diff --git a/conf.h b/conf.h index 7b73252..4d3385e 100644 --- a/conf.h +++ b/conf.h @@ -35,11 +35,11 @@ static struct highlight { {"---", {SYN_BGMK(7) | 8 | SYN_BD, 4, 1}, "^(\".\").(\[[wr]\]).$"}, {"---", {SYN_BGMK(7) | 8 | SYN_BD, 4, 4}, "^(\".\").=.(L[0-9]+) +(C[0-9]+).$"}, {"---", {SYN_BGMK(8) | 0 | SYN_BD, 4, 4}, "^(\".\").-.(L[0-9]+) +(C[0-9]+).*$"},

By the way, because my terminal supports the 256-colour palette, I modify syntax highlighting colours in conf.h very much.

Ali
lobre commented 8 months ago

Yes, it is way better with this patch. Does this patch work both for light and dark terminal themes?

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Yes, it is way better with this patch. Does this patch work both for light and dark terminal themes?

Yes.

How about this one?

Ali

diff --git a/conf.h b/conf.h index 7b73252..9a2f3f8 100644 --- a/conf.h +++ b/conf.h @@ -32,14 +32,14 @@ static struct highlight { int end; / the group ending this pattern / } highlights[] = { / status bar /

lobre commented 8 months ago

It's not as pretty as the first patch.

image

I cannot read what is in the unfocused (bottom one) status line. Also, the grey is not as "pretty", and I am not a fan of this yellow for the command line.

I would personally prefer not to change the color of the statusline whether is it focused or not (same as in nvi). It keeps the colors simple.

Something like the following.

diff --git a/conf.h b/conf.h
index 7b73252..2289db3 100644
--- a/conf.h
+++ b/conf.h
@@ -34,8 +34,8 @@ static struct highlight {
        /* status bar */
        {"---", {SYN_BGMK(7) | 8 | SYN_BD, 4, 1}, "^(\".*\").*(\\[[wr]\\]).*$"},
        {"---", {SYN_BGMK(7) | 8 | SYN_BD, 4, 4}, "^(\".*\").*=.*(L[0-9]+) +(C[0-9]+).*$"},
-       {"---", {SYN_BGMK(8) | 0 | SYN_BD, 4, 4}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
-       {"---", {SYN_BGMK(7) | SYN_BD}, ".*$\n?"},
+       {"---", {SYN_BGMK(7) | 8 | SYN_BD, 4, 4}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
+       {"---", {SYN_BGMK(7) | 8 | SYN_BD}, ".*$\n?"},
        /* ex mode */
        {"-ex", {SYN_BGMK(7) | SYN_BD}, ":.*$\n?"},
        {"-ex", {SYN_BGMK(7) | SYN_BD}, "\\[.*$\n?"},

What do you think?

lobre commented 8 months ago

Also, now when the statusline is empty, it stays with white background. It is odd.

image

Do you think there can be a way to keep it the same color as the background when nothing it printed on that line? So that it becomes (as before):

image

If not possible, I think I would prefer anyway to have the current filename always printed on that line instead of a blank white space. Like the patch you proposed in another issue (even if it might require more rendering).

diff --git a/vi.c b/vi.c
index f1f51d2..1d332cf 100644
--- a/vi.c
+++ b/vi.c
@@ -1278,7 +1278,6 @@ static void vi(void)
                int otop = xtop;
                int oleft = xleft;
                int orow = xrow;
-               char *opath = ex_path();        /* do not dereference; to detect buffer changes */
                int mv, n;
                term_cmd(&n);
                vi_arg2 = 0;
@@ -1640,7 +1639,7 @@ static void vi(void)
                        if (msg[0])
                                strcpy(vi_msg, msg);
                }
-               if (!vi_msg[0] && (w_cnt > 1 || opath != ex_path()))
+               if (!vi_msg[0])
                        vc_status();
                if (mod || xleft != oleft) {
                        vi_drawagain(xcol, mod == 2 && xleft == oleft && xrow == orow);
aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Also, now when the statusline is empty, it stays with white background. It is odd.

image

Do you think there can be a way to keep it the same color as the background when nothing it printed on that line? So that it becomes (as before):

image

If not possible, I think I would prefer anyway to have the current filename always printed on that line instead of a blank white space. Like the patch you proposed in another issue (even if it might require more rendering).

It is probably because your terminal changes the colour of bold text. You can probably find an option with the description "show bold text in bright colors". Please turn it off.

Ali
aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Also, now when the statusline is empty, it stays with white background. It is odd.

Or maybe 7 and 15 are the same colour?

Ali
lobre commented 8 months ago

image

I disabled bold text entirely and same issue.

And for the empty white statusline, I changed my colors for 7 and 15 to completely other colors (purple and brown), and the statusline seems to stay empty with a purple background (so it seems to be painted with color7).

image

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

image

I disabled bold text entirely and same issue.

And for the empty white statusline, I changed my colors for 7 and 15 to completely other colors (purple and brown), and the statusline seems to stay empty with a purple background (so it seems to be painted with color7).

image

Then I think the safest way is to stick to the first 8 colour. How about this.

Ali

diff --git a/conf.h b/conf.h index a92a05a..b95c5c5 100644 --- a/conf.h +++ b/conf.h @@ -29,9 +29,9 @@ static struct filetype {

define CCON (CKWD) / control flow keywords /

define CPRE (2 | SYN_BD) / preprocessor directives /

define CIMP (4 | SYN_BD) / imported packages /

-#define CTYP (8 | SYN_BD) / built-in types and values / -#define CBIN (8 | SYN_BD) / built-in functions / -#define CCMT (12 | SYN_IT) / comments / +#define CTYP (3) / built-in types and values / +#define CBIN (3) / built-in functions / +#define CCMT (4 | SYN_IT) / comments /

define CDEF (4 | SYN_BD) / top-level definition /

define CFUN (SYN_BD) / called functions /

define CNUM 4 / numerical constants /

@@ -47,14 +47,14 @@ static struct highlight { int end; / the group ending this pattern / } highlights[] = { / status bar /

lobre commented 8 months ago

It is still weird. Though, going down the route of choosing only 8 colors can be nice as the default so that even people with few colors would have a good native xp.

I am trying to come up with a patch that could make sense, but I realize that I don't manage to find the "background color". When I use 0, it uses the terminal foreground color, but I do not find a way to either choose the terminal background color, or not use any color at all.

Do you know if there is a way to do this?

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

It is still weird. Though, going down the route of choosing only 8 colors can be nice as the default so that even people with few colors would have a good native xp.

I am trying to come up with a patch that could make sense, but I realize that I don't manage to find the "background color". When I use 0, it uses the terminal foreground color, but I do not find a way to either choose the terminal background color, or not use any color at all.

Do you know if there is a way to do this?

Neatvi uses the foreground and background colours, unless overridden.

Attributes in highlights[] are applied based on regular expression group containment. If we have an entry in highlights[] like this:

{"filetype", {attr0, attr1, attr2}, "abc (def) (ghi)"}

abc is highlighted using attr0, def is highlighted using attr0+attr1, and ghi using attr0+attr2. If, for instance, you need the background colour in def, you must not specify the background (i.e. no SYN_BGMK) in attr0 and attr1.

Ali
lobre commented 8 months ago

Thanks for explaining this. There is still something that I don't get though.

I will use this back script as reference to show the 16 ansi colors. On top of that, there is also the default background, default foreground, or the possibility to apply reverse. But I am not talking about that here. Just the first 16 ansi colors.

$ cat ./colors.sh 
#!/bin/bash

for i in {0..15}; do
    printf "\e[38;5;${i}mColor %02d\e[0m\t" $i
    printf "\e[48;5;${i}m   \e[0m\n"
done

See the result in my terminal.

image

And I would like to have a statusline that is white, using color 7, and using the black which is color 0 (we don't see it clearly on my screenshot as my color 0 is lighter but close to the background). But it seems it does not apply this black as foreground. Instead, it uses the default foreground of the terminal.

...
{"---", {SYN_BGMK(7) | 0}, ".*$\n?"}
...

Do you know why? Is there a way to apply color 0 as the foreground of my statusline?

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Do you know why? Is there a way to apply color 0 as the foreground of my statusline?

You can use the SYN_FGMK(0) for that.

Ali
lobre commented 8 months ago

Thank you. I need to think more about this, but I feel that neatvi it trying to do too much in terms of colors for the statusline. The out of the box xp for me is not good (at least with my colors). See with latest version how it looks like for both single and dual windows.

When I open neatvi, I do have:

image

Then, if I do ^D:

image

Then if I split:

image

I do have a rather normal dark terminal palette more or less following base ANSI colors. Either I see an empty bar that visually takes space, or I have two windows and I cannot realize which one is the current pane between the black or white panel.

I think colors should be really minimal so that the default experience is super simple, and then if people want to do fancy stuff, they can opt-in as they can modify conf.h. And it should work both for dark and light terminal colors, and be clean whatever the value of set hl/set nohl.

As an example, take nvi which follows this principle of having simple defaults. Only black and white are used, and in a consistent and ergonomic manner.

When I open it, I do have:

image

If I type a command:

image

If I scroll (^D), it stays as the first screenshot, keeping the ruler in the middle and the command mode at the bottom right (in nvi, the ruler can be disabled in config so avoids having to re-render it when disabled I guess).

Now if I split in 2 windows, it needs a way to show the user that there are two panes, and so reverses the background and foreground:

image

You can clearly see which pane is active (as it contains the full bar):

image

And here is what happens if I try to enter a command while in dual-window mode:

image

And here are a few screenshots with a light terminal theme. The colors reverse and one can still understand what happens easily.

Normal:

image

Command:

image

Two windows:

image

Two windows with command:

image

What do you think about it?

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Thank you. I need to think more about this, but I feel that neatvi it trying to do too much in terms of colors for the statusline. The out of the box xp for me is not good (at least with my colors). See with latest version how it looks like for both single and dual windows.

When I open neatvi, I do have:

image

Then, if I do ^D:

image

Then if I split:

image

I do have a rather normal dark terminal palette more or less following base ANSI colors. Either I see an empty bar that visually takes space, or I have two windows and I cannot realize which one is the current pane between the black or white panel.

I think colors should be really minimal so that the default experience is super simple, and then if people want to do fancy stuff, they can opt-in as they can modify conf.h. And it should work both for dark and light terminal colors, and be clean whatever the value of set hl/set nohl.

As an example, take nvi which follows this principle of having simple defaults. Only black and white are used, and in a consistent and ergonomic manner.

When I open it, I do have:

image

If I type a command:

image

If I scroll (^D), it stays as the first screenshot, keeping the ruler in the middle and the command mode at the bottom right (in nvi, the ruler can be disabled in config so avoids having to re-render it when disabled I guess).

Now if I split in 2 windows, it needs a way to show the user that there are two panes, and so reverses the background and foreground:

image

You can clearly see which pane is active (as it contains the full bar):

image

And here is what happens if I try to enter a command while in dual-window mode:

image

And here are a few screenshots with a light terminal theme. The colors reverse and one can still understand what happens easily.

Normal:

image

Command:

image

Two windows:

image

Two windows with command:

image

Thanks for the screenshots. Interesting.

What do you think about it?

If you like the reverse colour mode, you can simply use SYN_RV.

Sticking to colours 0-7 is a good idea because not every terminal supports 256-colour palette.

The colour of the status line in Neatvi, whatever it is, may be very close to the background colour of the terminal (unless the reverse colour mode is used). However, that must not be a problem in general.

The colour of the status line helps when two windows are shown. Maybe we can use the same background colour but non-bold single-colour foreground for non-active window?

Ali
aligrudi commented 8 months ago

The same background colour the for status line of the active and non-active windows:

diff --git a/conf.h b/conf.h index 1f8fe0d..f32833d 100644 --- a/conf.h +++ b/conf.h @@ -49,7 +49,7 @@ static struct highlight { / status bar / {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 1}, "^(\".\").(\[[wr]\]).$"}, {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 5, 7}, "^(\".\").=.(L[0-9]+) +(C[0-9]+).*$"},

You may also like this (combined with the reverse colour mode):

diff --git a/conf.h b/conf.h index 1f8fe0d..d83418a 100644 --- a/conf.h +++ b/conf.h @@ -47,10 +47,10 @@ static struct highlight { int end; / the group ending this pattern / } highlights[] = { / status bar /

lobre commented 8 months ago

Thanks for the guidance. Your first solution is not that bad. But I think removing the background color when the statusline is empty makes it prettier.

diff --git a/conf.h b/conf.h                                                                                                                               │*** use it for notes or open a file buffer with the :edit command ***
index 1f8fe0d..d5534f3 100644                                                                                                                              │~
--- a/conf.h                                                                                                                                               │~
+++ b/conf.h                                                                                                                                               │~
@@ -47,10 +47,10 @@ static struct highlight {                                                                                                              │~
        int end;                /* the group ending this pattern */                                                                                        │~
 } highlights[] = {                                                                                                                                        │~
        /* status bar */                                                                                                                                   │~
-       {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 1}, "^(\".*\").*(\\[[wr]\\]).*$"},                                                                           │~
-       {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 5, 7}, "^(\".*\").*=.*(L[0-9]+) +(C[0-9]+).*$"},                                                             │~
-       {"---", {SYN_BGMK(7) | 6}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},                                                                               │~
-       {"---", {SYN_BGMK(0) | 3 | SYN_BD}, ".*$\n?"},                                                                                                     │~
+       {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 1}, "^(\".*\").*(\\[[wr]\\]).*$"}, // single window                                                          │~
+       {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 5, 7}, "^(\".*\").*=.*(L[0-9]+) +(C[0-9]+).*$"}, // split active                                             │~
+       {"---", {SYN_BGMK(0) | 7}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"}, // split inactive                                                             │~
+       {"---", {7}, ".*$\n?"}, // single window split                                                                                                     │~
        /* ex mode */                                                                                                                                      │~
        {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, ":.*$\n?"},                                                                                                    │~
        {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, "\\[.*$\n?"},

Also, I do prefer when bold is used sparingly, so I think that commands should not be bold.

This patch looks better to me as the native xp is improved already.

The last problem I see is that there is no possibility to remove this white background when set nohl is defined, and when the statusline is empty (for single window). Not sure what can be done here...

image

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

Thanks for the guidance. Your first solution is not that bad. But I think removing the background color when the statusline is empty makes it prettier.

You can add a rule like the following just before the last one, to achieve that:

    {"---", {0}, "^$"},
Ali
lobre commented 8 months ago

I think I can use the last line instead of adding one more (sorry my last post was a broken patch):

diff --git a/conf.h b/conf.h
index 1f8fe0d..6b40a02 100644
--- a/conf.h
+++ b/conf.h
@@ -49,8 +49,8 @@ static struct highlight {
    /* status bar */
    {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 1}, "^(\".*\").*(\\[[wr]\\]).*$"},
    {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 5, 7}, "^(\".*\").*=.*(L[0-9]+) +(C[0-9]+).*$"},
-   {"---", {SYN_BGMK(7) | 6}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
-   {"---", {SYN_BGMK(0) | 3 | SYN_BD}, ".*$\n?"},
+   {"---", {SYN_BGMK(0) | 7}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
+   {"---", {0}, ".*$\n?"},
    /* ex mode */
    {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, ":.*$\n?"},
    {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, "\\[.*$\n?"},

So {"---", {0}, ".*$\n?"}, matches and allows removing the background when the window is scrolled.

To me, this patch makes neatvi consistent. Not sure how it reacts for you, but I also tested with a light theme and it also seems fine.

For set nohl, since this commit, the reverse is hard coded, so it seems there is nothing I can do to put the same color as the background when scrolled. Do you have an idea?

aligrudi commented 8 months ago

Loric Brevet @.***> wrote:

I think I can use the last line instead of adding one more (sorry my last post was a broken patch):

diff --git a/conf.h b/conf.h
index 1f8fe0d..6b40a02 100644
--- a/conf.h
+++ b/conf.h
@@ -49,8 +49,8 @@ static struct highlight {
  /* status bar */
  {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 1}, "^(\".*\").*(\\[[wr]\\]).*$"},
  {"---", {SYN_BGMK(0) | 7 | SYN_BD, 3, 5, 7}, "^(\".*\").*=.*(L[0-9]+) +(C[0-9]+).*$"},
- {"---", {SYN_BGMK(7) | 6}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
- {"---", {SYN_BGMK(0) | 3 | SYN_BD}, ".*$\n?"},
+ {"---", {SYN_BGMK(0) | 7}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
+ {"---", {0}, ".*$\n?"},
  /* ex mode */
  {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, ":.*$\n?"},
  {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, "\\[.*$\n?"},

So {"---", {0}, ".*$\n?"}, matches and allows removing the background when the window is scrolled.

To me, this patch makes neatvi consistent. Not sure how it reacts for you, but I also tested with a light theme and it also seems fine.

I have no problem with an empty status line.

How about using cyan instead of yellow? It is usually brighter:

    {"---", {SYN_BGMK(0) | 7 | SYN_BD, 6, 1}, "^(\".*\").*(\\[[wr]\\]).*$"},
    {"---", {SYN_BGMK(0) | 7 | SYN_BD, 6, 5, 7}, "^(\".*\").*=.*(L[0-9]+) +(C[0-9]+).*$"},
    {"---", {SYN_BGMK(0) | 7}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
    {"---", {SYN_BGMK(0) | 6 | SYN_BD}, ".*$"},

Thanks, Ali

lobre commented 8 months ago

I am not sure I prefer cyan (6) over green (2). Green is fine with me.

Here is a patch that I quite like.

diff --git a/conf.h b/conf.h
index 6dec2d0..1128ae5 100644
--- a/conf.h
+++ b/conf.h
@@ -49,8 +49,8 @@ static struct highlight {
        /* status bar */
        {"---", {SYN_BGMK(0) | 7 | SYN_BD, 2, 1}, "^(\".*\").*(\\[[wr]\\]).*$"},
        {"---", {SYN_BGMK(0) | 7 | SYN_BD, 2, 5, 7}, "^(\".*\").*=.*(L[0-9]+) +(C[0-9]+).*$"},
-       {"---", {SYN_BGMK(0) | 7}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
-       {"---", {SYN_BGMK(0) | 2 | SYN_BD}, ".*$"},
+       {"---", {SYN_BGMK(0) | 7, 2, 5, 7}, "^(\".*\").*-.*(L[0-9]+) +(C[0-9]+).*$"},
+       {"---", {SYN_BGMK(0) | 7}, ".*$"},
        /* ex mode */
        {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, ":.*$"},
        {"-ex", {SYN_BGMK(0) | 7 | SYN_BD}, "\\[.*$"},
diff --git a/vi.c b/vi.c
index e1ddb2a..c0a205a 100644
--- a/vi.c
+++ b/vi.c
@@ -1640,7 +1640,7 @@ static void vi(void)
                        if (msg[0])
                                strcpy(vi_msg, msg);
                }
-               if (!vi_msg[0] && (w_cnt > 1 || opath != ex_path()))
+               if (!vi_msg[0] && (w_cnt > 1 || opath != ex_path() || !xhl))
                        vc_status();
                if (mod || xleft != oleft) {
                        vi_drawagain(xcol, mod == 2 && xleft == oleft && xrow == orow);

It does multiple things:

  1. It uses the same colors for active and inactive status lines, and the active one is just bold. I think that defining a primary element over a secondary does not need a change of both thickness and color. It is too distracting to the eye, and I checked with other vi-likes, including neovim, and they only change one parameter to differentiate.
  2. It removes bold for the command prompt. I still find it weird to type my user commands in bold (maybe you don't share the same feeling).
  3. It refreshes the status line more often when nohl is set. I think it can be a good middle ground to avoid this white empty line (which is to me visually drawing attention to empty information).

What do you think?

aligrudi commented 7 months ago

Loric Brevet @.***> wrote:

It does multiple things:

  1. It uses the same colors for active and inactive status lines, and the active one is just bold. I think that defining a primary element over a secondary does not need a change of both thickness and color. It is too distracting to the eye, and I checked with other vi-likes, including neovim, and they only change one parameter to differentiate.
  2. It removes bold for the command prompt. I still find it weird to type my user commands in bold (maybe you don't share the same feeling).
  3. It refreshes the status line more often when nohl is set. I think it can be a good middle ground to avoid this white empty line (which is to me visually drawing attention to empty information).

What do you think?

I guess your bold font is relatively heavy.

Ali
lobre commented 7 months ago

Since the last few commits, the current state is satisfying to me.

As a reminder, when set nohl is enabled, the statusline will be in reverse color mode. And otherwise, the statusline has enough foreground/background contrast. We also clearly differentiate which split is active. And the used colors are ANSI 0-7 to work on almost all terminal emulators. Also, has the ruler option has been added, we don't want any custom background color of this statusline when it is empty. It means the code is more consistent as there is no need to have a custom behavior here.

@aligrudi, do you have anything else to add, or should I close this issue?