-
How to reproduce:
- Add the following code to ScintilaTest xcode project, AppController.mm,
- (void) setupEditor
method.
- Add the following code to ScintilaTest xcode project, AppController.mm,
// Marker setup. [mEditor setGeneralProperty: SCI_SETMARGINWIDTHN parameter: 1 value: 0]; [mEditor setGeneralProperty: SCI_MARKERDEFINEPIXMAP parameter: 0 value: (sptr_t)box_xpm]; [mEditor setGeneralProperty: SCI_MARKERADD parameter: 0 value: 0];
1. Run the project
* What do I see:
The first line has red bacground
* What do I expect:
The first line has white background, and there is no margin for the marker I added.
i.e. no visual diff between this program and the original program.
* What do I find
In `ViewStyle::CalculateMarginWidthAndMask()`, the bitwise operations on maskInLine will be skipped for margin with zero width.
if (ms[margin].width > 0) maskInLine &= ~ms[margin].mask;
However, in `ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret)`, we will use maskInLine to do a checking.
If these bitwise operations are skipped, the checking pass and the original background colour, white in this case, will be overwritten.
int marksMasked = marksOfLine & maskInLine; if (marksMasked) { for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { if ((marksMasked & 1) && (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { background = ColourOptional(markers[markBit].back, true); } marksMasked >>= 1; } }
* Possible fix
remove `if (ms[margin].width > 0)` from `ViewStyle::CalculateMarginWidthAndMask()`