-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
[RDY]:hi Normal works with -u NONE #6973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/nvim/syntax.c
Outdated
|
||
// HACK we need to make sure that the first highlight is the "Normal" hl | ||
if (highlight_ga.ga_len == 0) { | ||
int res = syn_add_group((char_u *)"Normal"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syn_add_group()
requires its argument to be an allocated string. You're passing a static string instead. Try this:
int res = syn_add_group((char_u *)xstrdup("Normal"));
src/nvim/syntax_defs.h
Outdated
@@ -73,4 +73,14 @@ typedef struct attr_entry { | |||
int cterm_fg_color, cterm_bg_color; | |||
} attrentry_T; | |||
|
|||
#define ATTRENTRY_INIT {.rgb_ae_attr = 0, .cterm_ae_attr = 0, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put rgb_ae_attr
and cterm_ae_attr
on their own lines too? It looks a little odd having these two here but everything else on its own line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/nvim/syntax.c
Outdated
// HACK we need to make sure that the first highlight is the "Normal" hl | ||
if (highlight_ga.ga_len == 0) { | ||
int res = syn_add_group((char_u *)xstrdup("Normal")); | ||
assert(res == 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add a (void)res;
line so release builds think res
is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I would like to move the Normal hl creation to init_highlight but that would need more thoughts/tests as I am afraid :high Normal NONE
or some other command could break things.
|
not sure https://travis-ci.org/neovim/neovim/jobs/251093995#L2732 is related to my changes:
is it possible to restart the failed tests please ? |
Done. |
Codecov Report
@@ Coverage Diff @@
## master #6973 +/- ##
==========================================
+ Coverage 77.03% 77.05% +0.01%
==========================================
Files 131 131
Lines 106919 106925 +6
Branches 25630 25628 -2
==========================================
+ Hits 82365 82389 +24
+ Misses 24544 24526 -18
Partials 10 10
Continue to review full report at Codecov.
|
I updated the first post to better reflect the current content. |
Would be happy to see this merged (even if only the first commit) as it solves the |
|
||
if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0) | ||
is_normal_group = TRUE; | ||
is_normal_group = (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before, is_normal_group
kept its value if the if-block was not entered. Is this change intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the only place that sets is_normal_group so it's equivalent.
src/nvim/syntax.c
Outdated
/// Table with the specifications for an attribute number. | ||
/// Note that this table is used by ALL buffers. This is required because the | ||
/// GUI can redraw at any time for any buffer. | ||
/// The attributes table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the last line seems a bit unnecessary
src/nvim/syntax.c
Outdated
* Lookup a highlight group name and return it's ID. | ||
* If it is not found, 0 is returned. | ||
*/ | ||
/// Lookup a highlight group name and return it's ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"its"
src/nvim/syntax.c
Outdated
/// Lookup a highlight group name and return it's ID. | ||
/// | ||
/// @param highlight name e.g. 'Cursor', 'Normal' | ||
/// @return the highlight id, else 0 if it \p name does not exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omit "it"
* "name" must be an allocated string, it will be consumed. | ||
* Return 0 for failure. | ||
*/ | ||
/// Add new highlight group and return it's ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"its"
Great to see smaller PRs, it helps a lot :> LGTM, one comment: #6973 (comment) |
The failure does not seem related to the changes:
|
- :hi Normal works with -u NONE - Makes HL_TABLE and ATTR_ENTYRY a function instead of a macro so that in can be used in gdb. - Introduces ATTRENTRY_INIT to init attrentry_t
Converts some documentation to doxygen format + minor styling improvements.
Thanks for the review, I rebased and pushed your fixes. Should be ok now. |
FEATURES: 0e873a3 Lua(Jit) built-in neovim#4411 5b32bce Windows: `:terminal` neovim#7007 7b0ceb3 UI/API: externalize cmdline neovim#7173 b67f58b UI/API: externalize wildmenu neovim#7454 b23aa1c UI: 'winhighlight' neovim#6597 17531ed UI: command-line coloring (`:help input()-highlight`) neovim#6364 244a1f9 API: execute lua directly from the remote api neovim#6704 45626de API: `get_keymap()` neovim#6236 db99982 API: `nvim_get_hl_by_name()`, `nvim_get_hl_by_id()` neovim#7082 dc68538 menu_get() function neovim#6322 9db42d4 :cquit : take an error code argument neovim#7336 9cc185d job-control: serverstart(): support ipv6 neovim#6680 1b7a9bf job-control: sockopen() neovim#6594 6efe84a clipboard: fallback to tmux clipboard neovim#6894 6016ac2 clipboard: customize clipboard with `g:clipboard` neovim#6030 3a86dd5 ruby: override ruby host via `g:ruby_host_prog` neovim#6841 16cce1a debug: $NVIM_LOG_FILE neovim#6827 0cba3da `:checkhealth` built-in, validates $VIMRUNTIME neovim#7399 FIXES: 105d680 TUI: more terminals, improve scroll/resize neovim#6816 cb912a3 :terminal : handle F1-F12, other keys neovim#7241 619838f inccommand: improve performance neovim#6949 04b3c32 inccommand: Fix matches for zero-width neovim#7487 60b1e8a inccommand: multiline, other fixes neovim#7315 f1f7f3b inccommand: Ignore leading modifiers in the command neovim#6967 1551f71 inccommand: fix 'gdefault' lockup neovim#7262 6338199 API: bufhl: support creating new groups neovim#7414 541dde3 API: allow K_EVENT during operator-pending 8c732f7 terminal: adjust for 'number' neovim#7440 5bec946 UI: preserve wildmenu during jobs/events neovim#7110 c349083 UI: disable 'lazyredraw' during ui_refresh. neovim#6259 51808a2 send FocusGained/FocusLost event instead of pseudokey neovim#7221 133f8bc shada: preserve unnamed register on restart neovim#4700 1b70a1d shada: avoid assertion on corrupt shada file neovim#6958 9f534f3 mksession: Restore tab-local working directory neovim#6859 de1084f fix buf_write() crash neovim#7140 7f76986 syntax: register 'Normal' highlight group neovim#6973 6e7a8c3 RPC: close channel if stream was closed neovim#7081 85f3084 clipboard: disallow recursion; show hint only once neovim#7203 8d1ccb6 clipboard: performance, avoid weird edge-cases neovim#7193 01487d4 'titleold' neovim#7358 01e53a5 Windows: better path-handling, separator (slash) hygiene neovim#7349 0f2873c Windows: multibyte startup arguments neovim#7060 CHANGES: 9ff0cc7 :terminal : start in normal-mode neovim#6808 032b088 lower priority of 'cursorcolumn', 'colorcolumn' neovim#7364 2a3bcd1 RPC: Don't delay notifications when request is pending neovim#6544 023f67c :terminal : Do not change 'number', 'relativenumber' neovim#6796 1ef2d76 socket.c: Disable Nagle's algorithm on TCP sockets neovim#6915 6720fe2 help: `K` tries Vim help instead of manpage neovim#3104 7068370 help, man.vim: change "outline" map to `gO` neovim#7405
The PR has 2 commits, the first one makes
:hi Normal works with -u NONE
works, just like vim.This first commit also:
The 2nd commit is just some documentation/styling changes (brackets) I had made to fix linting issues in another PR. I salvaged them but they are not necessary (might need to do another pass at it) so I can ditch it or send it another PR it that.
Nb: #6566 had become a mess so I am trying to split it into meaningful commits.