Problem solved: Remembering RGB colors is difficult.
Solution: Allow user to (re-)define new color names.
This patch is a follow-up to the discussion on #8502.
A central question in that discussion was how users would put the new v:colornames
dict to use and whether a single shared dict was appropriate. My own opinion is that a single shared dict is simultaneously the most approachable and the most usable. I've extended my previous work in an attempt to demonstrate why I think that is the case.
rgb.txt
file while retaining the same list of colors.
v:colornames
, the rgb.txt
colors are put into a default color list, which is re-executed when a user would have expected the rgb.txt
colors to be valid.Finally, the color name code has been moved into highlight.c
as suggested by @brammool. Thanks to Bram, @chrisbra, and @romainl for the helpful feedback on the last PR. I'm looking forward to any feedback you all have on this update/alternative.
https://github.com/vim/vim/pull/8761
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
Merging #8761 (c07d147) into master (b033ee2) will decrease coverage by
87.69%
.
The diff coverage is1.31%
.
❗ Current head c07d147 differs from pull request most recent head 0241aa1. Consider uploading reports for the commit 0241aa1 to get more accurate results
@@ Coverage Diff @@ ## master #8761 +/- ## =========================================== - Coverage 90.15% 2.46% -87.70% =========================================== Files 151 149 -2 Lines 170639 165393 -5246 =========================================== - Hits 153839 4073 -149766 - Misses 16800 161320 +144520
Flag | Coverage Δ | |
---|---|---|
huge-clang-none | ? |
|
huge-gcc-none | ? |
|
huge-gcc-testgui | ? |
|
huge-gcc-unittests | 2.46% <1.31%> (+<0.01%) |
⬆️ |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
src/highlight.c | 7.62% <0.00%> (-82.85%) |
⬇️ |
src/memline.c | 0.00% <ø> (-88.77%) |
⬇️ |
src/term.c | 0.00% <ø> (-83.30%) |
⬇️ |
src/userfunc.c | 0.18% <0.00%> (-95.10%) |
⬇️ |
src/version.c | 0.86% <ø> (-91.48%) |
⬇️ |
src/vim9compile.c | 0.00% <0.00%> (-93.81%) |
⬇️ |
src/evalvars.c | 5.18% <100.00%> (-91.30%) |
⬇️ |
src/float.c | 0.00% <0.00%> (-99.22%) |
⬇️ |
src/gui_gtk_f.c | 0.00% <0.00%> (-97.54%) |
⬇️ |
src/sound.c | 0.00% <0.00%> (-97.12%) |
⬇️ |
... and 144 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update b033ee2...0241aa1. Read the comment docs.
@chrisbra I finally had a chance to fix the test failures on this branch. Mind approving the test run again?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
of course!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
For default.vim, instead of calling has_key() for every entry, you can use extend(v:colornames, {dict with values}, 'keep')
That should be much faster.
I notice that the loopup in rgb_table[] just uses a linear search. A binary search would be much better.
It is unrelated to v:colornames, could leave this as a todo item.
Otherwise, I'll leave this open for remarks. Is using v:colornames the best solution?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
My original motivation for using has_key
in default.vim
was to remain vi compatible. I'd be fine using extend
there however I tried it recently and it is significantly slower, to the point of causing the CI jobs to time out: https://github.com/dvogel/vim/actions/runs/1238981661.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
I've pushed an additional commit that requires uses extend
for better performance. The trade-off is that the default colors now require vi-incompatible line continuations. This was at the heart of why the tests were hanging with my first attempt to use extend
the Test_background_foreground
test relies on the color ivory
. Launching that test in nocompatible
mode allows it to run without hanging the test suite.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
See the runtime files for examples of how the 'cpo' option is changed and restored to allow for line continuation. Basically:
let s:cpo_save = &cpo
set cpo&vim
commands
let &cpo = s:cpo_save
unlet s:cpo_save
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Setting and restoring 'cpo' will also be needed in csscolors.vim
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Drew - have you looked into fixing the line continuation?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Yeah the color lists included in the patch all use the line continuations with the compatibility flag save/restore pattern you suggested. I haven't had a chance to look into the merge conflicts that arose from the refactor of the highlighting code yet.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
Looks like it was just a conflict due to a tiny comment correction I made. I've rebased this branch atop the master
branch, squashing my commits in the process.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub.