StyledTextCtrl样式掩码,它是什么?

2024-09-29 23:32:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在创建一个自定义的lexer。然后我发现StyledTextCtrl.StartTyling()是开始对文本应用样式的方法,但我不知道掩码是什么。我输入StartStyling.__doc__得到了这个

StyledTextCtrl.StartStyling(self, int pos, int mask)
Set the current styling position to pos and the styling mask to mask.
The styling mask can be used to protect some bits in each styling byte from modification.

如何在这里应用造型面膜?如何选择面膜编号?在


Tags: theto方法pos文本mask样式int
1条回答
网友
1楼 · 发布于 2024-09-29 23:32:41

本页解释了其中的大部分内容:

http://www.yellowbrain.com/stc/styling.html

The integer parameter pos sets the position where you'd like to begin styling operations. The integer parameter mask indicates which bits of the style bytes to modify.

From the Scintilla documentation: The mask allows styling to occur over several passes, with, for example, basic styling done on an initial pass to ensure that the text of the code is seen quickly and correctly, and then a second slower pass, detecting syntax errors and using indicators to show where these are. For example, with the standard settings of 5 style bits and 3 indicator bits, you would use a mask value of 31 (0x1f) if you were setting text styles and did not want to change the indicators.

您可能希望您的掩码是0x1f(低5位),这是惯例。低5位用于样式(最多32种不同样式),而高3位用于指示器。

相关问题 更多 >

    热门问题