Remove Colors.plist and fix CI

CI is currently failing since :highlight auto-complete relies on loading
v:colornames implicitly, but MacVim has its own special handling and
parses a bundled Colors.plist file instead, which bypasses the whole
system.  Colors.plist was added a long time ago as Vim did not have a
good cross-platform way to specify colors by names, but this has been
alleviated upstream a while ago via runtime/colors/lists/default.vim
which gets sourced for default color values.

To fix this, simply remove the file, as it serves no purpose anymore.
Also remove custom hex color parsing logic which also should simply
defer to Vim instead.
This commit is contained in:
Yee Cheng Chin
2025-03-02 19:41:23 -08:00
parent 597b39d5f6
commit 117efc784e
8 changed files with 25 additions and 1394 deletions
+14 -23
View File
@@ -402,32 +402,23 @@ top of the screen, you can set |MMNonNativeFullScreenShowMenu| to `NO` and
==============================================================================
5. Special colors *macvim-colors*
The colors in MacVim are defined in two dictionaries inside the "Resources"
folder of the application bundle (MacVim.app/Contents/Resources). It is
possible to add more colors by modifying these files. Color names are case
insensitive when accessed from Vim, but in the dictionary they must be
lowercase.
MacVim mostly uses standard Vim colors. See |gui-colors| and |v:colornames|
for how to set and override them.
*SystemColors.plist*
There are only a few system colors that can be accessed from Vim. These
colors are defined in the dictionary "SystemColors.plist". This dictionary
stores (key, value) pairs where the key is the name of the color and the
value is an NSColor selector name.
There are a few additional system colors that can be used in the |:hi|
command. These colors are defined in the dictionary "SystemColors.plist" in
the MacVim.app bundle. These color values correspond to NSColor selectors in
macOS. The available color names are:
The most useful system colors are: >
MacSelectedTextBackgroundColor
MacSecondarySelectedColor
The former is the "Highlight Color" which can be changed in the "Appearance"
section of the System Settings. The latter is the selection color used by
a Cocoa application when it is not in focus.
*Colors.plist*
Apart from the system colors, it is also possible to use the standard X11
color names (see https://en.wikipedia.org/wiki/X11_color_names) which usually
come in a file called "rgb.txt". MacVim does not have such a file, instead it
keeps these colors in a dictionary called "Colors.plist". The key in this
dictionary is the name of the color and the value is an RGB value on the form
#rrggbb stored as an integer.
KEY VALUE ~
MacSecondarySelectedControlColor Selection color when app is not in
focus.
MacSelectedTextBackgroundColor "Highlight Color" which can be changed
in the "Appearance" section of System
Settings.
MacTextBackgroundColor Normal text background color.
MacTextColor Normal text color.
*macvim-colorscheme*
MacVim ships with a custom color scheme that is used instead of the default
-1
View File
@@ -4124,7 +4124,6 @@ CmdwinEnter autocmd.txt /*CmdwinEnter*
CmdwinLeave autocmd.txt /*CmdwinLeave*
ColorScheme autocmd.txt /*ColorScheme*
ColorSchemePre autocmd.txt /*ColorSchemePre*
Colors.plist gui_mac.txt /*Colors.plist*
Command-line cmdline.txt /*Command-line*
Command-line-mode cmdline.txt /*Command-line-mode*
CompleteChanged autocmd.txt /*CompleteChanged*
File diff suppressed because it is too large Load Diff
-1
View File
@@ -22,7 +22,6 @@
NSConnection *vimServerConnection;
id appProxy;
unsigned long identifier;
NSDictionary *colorDict;
NSDictionary *sysColorDict;
NSDictionary *actionDict;
BOOL tabBarVisible;
+5 -26
View File
@@ -229,11 +229,8 @@ static struct specialkey
serverReplyDict = [[NSMutableDictionary alloc] init];
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *path = [mainBundle pathForResource:@"Colors" ofType:@"plist"];
if (path)
colorDict = [[NSDictionary dictionaryWithContentsOfFile:path] retain];
path = [mainBundle pathForResource:@"SystemColors" ofType:@"plist"];
NSString *path = [mainBundle pathForResource:@"SystemColors" ofType:@"plist"];
if (path)
sysColorDict = [[NSDictionary dictionaryWithContentsOfFile:path]
retain];
@@ -242,7 +239,7 @@ static struct specialkey
if (path)
actionDict = [[NSDictionary dictionaryWithContentsOfFile:path] retain];
if (!(colorDict && sysColorDict && actionDict)) {
if (!(sysColorDict && actionDict)) {
ASLogNotice(@"Failed to load dictionaries.%@", MMSymlinkWarningString);
}
@@ -270,7 +267,6 @@ static struct specialkey
[appProxy release]; appProxy = nil;
[actionDict release]; actionDict = nil;
[sysColorDict release]; sysColorDict = nil;
[colorDict release]; colorDict = nil;
[vimServerConnection release]; vimServerConnection = nil;
#ifdef FEAT_BEVAL
[lastToolTip release]; lastToolTip = nil;
@@ -1139,25 +1135,9 @@ static struct specialkey
componentsJoinedByString:@""];
if (stripKey && [stripKey length] > 0) {
// First of all try to lookup key in the color dictionary; note that
// all keys in this dictionary are lowercase with no whitespace.
id obj = [colorDict objectForKey:stripKey];
if (obj) return [obj intValue];
// The key was not in the dictionary; is it perhaps of the form
// #rrggbb?
if ([stripKey length] > 1 && [stripKey characterAtIndex:0] == '#') {
NSScanner *scanner = [NSScanner scannerWithString:stripKey];
[scanner setScanLocation:1];
unsigned hex = 0;
if ([scanner scanHexInt:&hex]) {
return (int)hex;
}
}
// As a last resort, check if it is one of the system defined colors.
// The keys in this dictionary are also lowercase with no whitespace.
obj = [sysColorDict objectForKey:stripKey];
// Check if it is one of the system defined colors. The keys in this
// dictionary are also lowercase with no whitespace.
id obj = [sysColorDict objectForKey:stripKey];
if (obj) {
NSColor *col = [NSColor performSelector:NSSelectorFromString(obj)];
if (col) {
@@ -1171,7 +1151,6 @@ static struct specialkey
}
}
ASLogNotice(@"No color with key %@ found.", stripKey);
return INVALCOLOR;
}
@@ -10,7 +10,6 @@
0395A8330D71ED7800881434 /* DBPrefsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0395A8320D71ED7800881434 /* DBPrefsWindowController.m */; };
0395A8AA0D72D88B00881434 /* General.png in Resources */ = {isa = PBXBuildFile; fileRef = 0395A8A90D72D88B00881434 /* General.png */; };
1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D09AB400C6A4D520045497E /* MMTypesetter.m */; };
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D0E051B0BA5F83800B6049E /* Colors.plist */; };
1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */; };
1D1474980C56703C0038FA2B /* MacVim.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474960C56703C0038FA2B /* MacVim.m */; };
1D1474A00C5673AE0038FA2B /* MMAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D14749E0C5673AE0038FA2B /* MMAppController.m */; };
@@ -172,7 +171,6 @@
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1D09AB3F0C6A4D520045497E /* MMTypesetter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMTypesetter.h; sourceTree = "<group>"; };
1D09AB400C6A4D520045497E /* MMTypesetter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMTypesetter.m; sourceTree = "<group>"; };
1D0E051B0BA5F83800B6049E /* Colors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Colors.plist; sourceTree = "<group>"; };
1D145C7D0E5227CE00691AA0 /* MMTextViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTextViewHelper.h; sourceTree = "<group>"; };
1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMTextViewHelper.m; sourceTree = "<group>"; };
1D1474950C56703C0038FA2B /* MacVim.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MacVim.h; sourceTree = "<group>"; };
@@ -669,7 +667,6 @@
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */,
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */,
1DD04DEB0C529C5E006CDC2B /* Credits.rtf */,
1D0E051B0BA5F83800B6049E /* Colors.plist */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
528DA6691426D4EB003380F1 /* macvim-askpass */,
@@ -1048,7 +1045,6 @@
buildActionMask = 2147483647;
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */,
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */,
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */,
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */,
@@ -11,7 +11,6 @@
0395A8330D71ED7800881434 /* DBPrefsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0395A8320D71ED7800881434 /* DBPrefsWindowController.m */; };
0395A8AA0D72D88B00881434 /* General.png in Resources */ = {isa = PBXBuildFile; fileRef = 0395A8A90D72D88B00881434 /* General.png */; };
1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D09AB400C6A4D520045497E /* MMTypesetter.m */; };
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D0E051B0BA5F83800B6049E /* Colors.plist */; };
1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */; };
1D1474980C56703C0038FA2B /* MacVim.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474960C56703C0038FA2B /* MacVim.m */; };
1D1474A00C5673AE0038FA2B /* MMAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D14749E0C5673AE0038FA2B /* MMAppController.m */; };
@@ -173,7 +172,6 @@
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1D09AB3F0C6A4D520045497E /* MMTypesetter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMTypesetter.h; sourceTree = "<group>"; };
1D09AB400C6A4D520045497E /* MMTypesetter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMTypesetter.m; sourceTree = "<group>"; };
1D0E051B0BA5F83800B6049E /* Colors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Colors.plist; sourceTree = "<group>"; };
1D145C7D0E5227CE00691AA0 /* MMTextViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTextViewHelper.h; sourceTree = "<group>"; };
1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMTextViewHelper.m; sourceTree = "<group>"; };
1D1474950C56703C0038FA2B /* MacVim.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MacVim.h; sourceTree = "<group>"; };
@@ -670,7 +668,6 @@
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */,
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */,
1DD04DEB0C529C5E006CDC2B /* Credits.rtf */,
1D0E051B0BA5F83800B6049E /* Colors.plist */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
528DA6691426D4EB003380F1 /* macvim-askpass */,
@@ -1049,7 +1046,6 @@
buildActionMask = 2147483647;
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */,
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */,
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */,
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */,
+6 -6
View File
@@ -1860,20 +1860,20 @@ gui_mch_flash(int msec UNUSED)
guicolor_T
gui_mch_get_color(char_u *name)
{
guicolor_T color = gui_get_color_cmn(name);
if (color != INVALCOLOR)
return color;
if (![MMBackend sharedInstance])
return INVALCOLOR;
char_u *u8name = CONVERT_TO_UTF8(name);
NSString *key = [NSString stringWithUTF8String:(char*)u8name];
guicolor_T color = [[MMBackend sharedInstance] lookupColorWithKey:key];
color = [[MMBackend sharedInstance] lookupColorWithKey:key];
CONVERT_TO_UTF8_FREE(u8name);
if (color != INVALCOLOR)
return color;
return gui_get_color_cmn(name);
return color;
}