mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Don't draw control chars in MMTextStorage
It can happen that MMTextStorage is asked to draw characters from the "Control Characters" set (e.g. when :shell is invoked). This would cause internal errors in MMTextStorage so when control chars are detected, simply draw blanks instead.
This commit is contained in:
@@ -258,6 +258,16 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|| col+cells > maxColumns || !string || !(fg && bg && sp))
|
||||
return;
|
||||
|
||||
BOOL hasControlChars = [string rangeOfCharacterFromSet:
|
||||
[NSCharacterSet controlCharacterSet]].location != NSNotFound;
|
||||
if (hasControlChars) {
|
||||
// HACK! If a string for some reason contains control characters, then
|
||||
// draw blanks instead (otherwise charRangeForRow::: fails).
|
||||
NSRange subRange = { 0, cells };
|
||||
flags &= ~DRAW_WIDE;
|
||||
string = [[emptyRowString string] substringWithRange:subRange];
|
||||
}
|
||||
|
||||
// Find range of characters in text storage to replace.
|
||||
int acol = col;
|
||||
int acells = cells;
|
||||
|
||||
Reference in New Issue
Block a user