Skip to content

Commit b52f01d

Browse files
committed
Fix non-CoreText renderer not working well with wide text
This was previously broken by #1287 as I did not update the new constants' values. Also, make strikethrough work in it. The non-CoreText renderer is essentially deprecated and will be removed in near future, but for now just fix up the straggling bugs since this is easy to do so. Fix #1296
1 parent 951e80d commit b52f01d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/MacVim/MMTextStorage.m

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,18 @@
4545
// TODO: What does DRAW_TRANSP flag do? If the background isn't drawn when
4646
// this flag is set, then sometimes the character after the cursor becomes
4747
// blank. Everything seems to work fine by just ignoring this flag.
48-
#define DRAW_TRANSP 0x01 /* draw with transparant bg */
49-
#define DRAW_BOLD 0x02 /* draw bold text */
50-
#define DRAW_UNDERL 0x04 /* draw underline text */
51-
#define DRAW_UNDERC 0x08 /* draw undercurl text */
52-
#define DRAW_ITALIC 0x10 /* draw italic text */
48+
#define DRAW_TRANSP 0x01 // draw with transparent bg
49+
#define DRAW_BOLD 0x02 // draw bold text
50+
#define DRAW_UNDERL 0x04 // draw underline text
51+
#define DRAW_UNDERC 0x08 // draw undercurl text
52+
#define DRAW_ITALIC 0x10 // draw italic text
5353
#define DRAW_CURSOR 0x20
54-
#define DRAW_WIDE 0x80 /* draw wide text */
54+
#define DRAW_STRIKE 0x40 // draw strikethrough text
55+
#define DRAW_UNDERDOUBLE 0x80 // draw double underline
56+
#define DRAW_UNDERDOTTED 0x100 // draw dotted underline
57+
#define DRAW_UNDERDASHED 0x200 // draw dashed underline
58+
#define DRAW_WIDE 0x1000 // (MacVim only) draw wide text
59+
#define DRAW_COMP 0x2000 // (MacVim only) drawing composing char
5560

5661

5762
static NSString *MMWideCharacterAttributeName = @"MMWideChar";
@@ -321,6 +326,12 @@ - (void)drawString:(NSString *)string atRow:(int)row column:(int)col
321326
[attributes setObject:value forKey:NSUnderlineStyleAttributeName];
322327
}
323328

329+
if (flags & DRAW_STRIKE) {
330+
NSNumber *value = [NSNumber numberWithInt:(NSUnderlineStyleSingle
331+
| NSUnderlinePatternSolid)]; // | NSUnderlineByWordMask
332+
[attributes setObject:value forKey:NSStrikethroughStyleAttributeName];
333+
}
334+
324335
if (flags & DRAW_UNDERC) {
325336
// TODO: figure out how do draw proper undercurls
326337
NSNumber *value = [NSNumber numberWithInt:(NSUnderlineStyleThick

0 commit comments

Comments
 (0)