control.py 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. # An Python interface to the Scintilla control.
  2. #
  3. # Exposes Python classes that allow you to use Scintilla as
  4. # a "standard" MFC edit control (eg, control.GetTextLength(), control.GetSel()
  5. # plus many Scintilla specific features (eg control.SCIAddStyledText())
  6. from pywin.mfc import window
  7. from pywin import default_scintilla_encoding
  8. import win32con
  9. import win32ui
  10. import win32api
  11. import array
  12. import struct
  13. import string
  14. import os
  15. from . import scintillacon
  16. # Load Scintilla.dll to get access to the control.
  17. # We expect to find this in the same directory as win32ui.pyd
  18. dllid = None
  19. if win32ui.debug: # If running _d version of Pythonwin...
  20. try:
  21. dllid = win32api.LoadLibrary(os.path.join(os.path.split(win32ui.__file__)[0], "Scintilla_d.DLL"))
  22. except win32api.error: # Not there - we dont _need_ a debug ver, so ignore this error.
  23. pass
  24. if dllid is None:
  25. try:
  26. dllid = win32api.LoadLibrary(os.path.join(os.path.split(win32ui.__file__)[0], "Scintilla.DLL"))
  27. except win32api.error:
  28. pass
  29. if dllid is None:
  30. # Still not there - lets see if Windows can find it by searching?
  31. dllid = win32api.LoadLibrary("Scintilla.DLL")
  32. # null_byte is str in py2k, bytes on py3k
  33. null_byte = "\0".encode('ascii')
  34. ## These are from Richedit.h - need to add to win32con or commctrl
  35. EM_GETTEXTRANGE = 1099
  36. EM_EXLINEFROMCHAR = 1078
  37. EM_FINDTEXTEX = 1103
  38. EM_GETSELTEXT = 1086
  39. EM_EXSETSEL = win32con.WM_USER + 55
  40. class ScintillaNotification:
  41. def __init__(self, **args):
  42. self.__dict__.update(args)
  43. class ScintillaControlInterface:
  44. def SCIUnpackNotifyMessage(self, msg):
  45. format = "iiiiPiiiPPiiii"
  46. bytes = win32ui.GetBytes( msg, struct.calcsize(format) )
  47. position, ch, modifiers, modificationType, text_ptr, \
  48. length, linesAdded, msg, wParam, lParam, line, \
  49. foldLevelNow, foldLevelPrev, margin \
  50. = struct.unpack(format, bytes)
  51. return ScintillaNotification(position=position,ch=ch,
  52. modifiers=modifiers, modificationType=modificationType,
  53. text_ptr = text_ptr, length=length, linesAdded=linesAdded,
  54. msg = msg, wParam = wParam, lParam = lParam,
  55. line = line, foldLevelNow = foldLevelNow, foldLevelPrev = foldLevelPrev,
  56. margin = margin)
  57. def SCIAddText(self, text):
  58. self.SendMessage(scintillacon.SCI_ADDTEXT, text.encode(default_scintilla_encoding))
  59. def SCIAddStyledText(self, text, style = None):
  60. # If style is None, text is assumed to be a "native" Scintilla buffer.
  61. # If style is specified, text is a normal string, and the style is
  62. # assumed to apply to the entire string.
  63. if style is not None:
  64. text = list(map(lambda char, style=style: char+chr(style), text))
  65. text = ''.join(text)
  66. self.SendMessage(scintillacon.SCI_ADDSTYLEDTEXT, text.encode(default_scintilla_encoding))
  67. def SCIInsertText(self, text, pos=-1):
  68. # SCIInsertText allows unicode or bytes - but if they are bytes,
  69. # the caller must ensure it is encoded correctly.
  70. if isinstance(text, str):
  71. text = text.encode(default_scintilla_encoding)
  72. self.SendScintilla(scintillacon.SCI_INSERTTEXT, pos, text + null_byte)
  73. def SCISetSavePoint(self):
  74. self.SendScintilla(scintillacon.SCI_SETSAVEPOINT)
  75. def SCISetUndoCollection(self, collectFlag):
  76. self.SendScintilla(scintillacon.SCI_SETUNDOCOLLECTION, collectFlag)
  77. def SCIBeginUndoAction(self):
  78. self.SendScintilla(scintillacon.SCI_BEGINUNDOACTION)
  79. def SCIEndUndoAction(self):
  80. self.SendScintilla(scintillacon.SCI_ENDUNDOACTION)
  81. def SCIGetCurrentPos(self):
  82. return self.SendScintilla(scintillacon.SCI_GETCURRENTPOS)
  83. def SCIGetCharAt(self, pos):
  84. # Must ensure char is unsigned!
  85. return chr(self.SendScintilla(scintillacon.SCI_GETCHARAT, pos) & 0xFF)
  86. def SCIGotoLine(self, line):
  87. self.SendScintilla(scintillacon.SCI_GOTOLINE, line)
  88. def SCIBraceMatch(self, pos, maxReStyle):
  89. return self.SendScintilla(scintillacon.SCI_BRACEMATCH, pos, maxReStyle)
  90. def SCIBraceHighlight(self, pos, posOpposite):
  91. return self.SendScintilla(scintillacon.SCI_BRACEHIGHLIGHT, pos, posOpposite)
  92. def SCIBraceBadHighlight(self, pos):
  93. return self.SendScintilla(scintillacon.SCI_BRACEBADLIGHT, pos)
  94. ####################################
  95. # Styling
  96. # def SCIColourise(self, start=0, end=-1):
  97. # NOTE - dependent on of we use builtin lexer, so handled below.
  98. def SCIGetEndStyled(self):
  99. return self.SendScintilla(scintillacon.SCI_GETENDSTYLED)
  100. def SCIStyleSetFore(self, num, v):
  101. return self.SendScintilla(scintillacon.SCI_STYLESETFORE, num, v)
  102. def SCIStyleSetBack(self, num, v):
  103. return self.SendScintilla(scintillacon.SCI_STYLESETBACK, num, v)
  104. def SCIStyleSetEOLFilled(self, num, v):
  105. return self.SendScintilla(scintillacon.SCI_STYLESETEOLFILLED, num, v)
  106. def SCIStyleSetFont(self, num, name, characterset=0):
  107. buff = (name + "\0").encode(default_scintilla_encoding)
  108. self.SendScintilla(scintillacon.SCI_STYLESETFONT, num, buff)
  109. self.SendScintilla(scintillacon.SCI_STYLESETCHARACTERSET, num, characterset)
  110. def SCIStyleSetBold(self, num, bBold):
  111. self.SendScintilla(scintillacon.SCI_STYLESETBOLD, num, bBold)
  112. def SCIStyleSetItalic(self, num, bItalic):
  113. self.SendScintilla(scintillacon.SCI_STYLESETITALIC, num, bItalic)
  114. def SCIStyleSetSize(self, num, size):
  115. self.SendScintilla(scintillacon.SCI_STYLESETSIZE, num, size)
  116. def SCIGetViewWS(self):
  117. return self.SendScintilla(scintillacon.SCI_GETVIEWWS)
  118. def SCISetViewWS(self, val):
  119. self.SendScintilla(scintillacon.SCI_SETVIEWWS, not (val==0))
  120. self.InvalidateRect()
  121. def SCISetIndentationGuides(self, val):
  122. self.SendScintilla(scintillacon.SCI_SETINDENTATIONGUIDES, val)
  123. def SCIGetIndentationGuides(self):
  124. return self.SendScintilla(scintillacon.SCI_GETINDENTATIONGUIDES)
  125. def SCISetIndent(self, val):
  126. self.SendScintilla(scintillacon.SCI_SETINDENT, val)
  127. def SCIGetIndent(self, val):
  128. return self.SendScintilla(scintillacon.SCI_GETINDENT)
  129. def SCIGetViewEOL(self):
  130. return self.SendScintilla(scintillacon.SCI_GETVIEWEOL)
  131. def SCISetViewEOL(self, val):
  132. self.SendScintilla(scintillacon.SCI_SETVIEWEOL, not(val==0))
  133. self.InvalidateRect()
  134. def SCISetTabWidth(self, width):
  135. self.SendScintilla(scintillacon.SCI_SETTABWIDTH, width, 0)
  136. def SCIStartStyling(self, pos, mask):
  137. self.SendScintilla(scintillacon.SCI_STARTSTYLING, pos, mask)
  138. def SCISetStyling(self, pos, attr):
  139. self.SendScintilla(scintillacon.SCI_SETSTYLING, pos, attr)
  140. def SCISetStylingEx(self, ray): # ray is an array.
  141. address, length = ray.buffer_info()
  142. self.SendScintilla(scintillacon.SCI_SETSTYLINGEX, length, address)
  143. def SCIGetStyleAt(self, pos):
  144. return self.SendScintilla(scintillacon.SCI_GETSTYLEAT, pos)
  145. def SCISetMarginWidth(self, width):
  146. self.SendScintilla(scintillacon.SCI_SETMARGINWIDTHN, 1, width)
  147. def SCISetMarginWidthN(self, n, width):
  148. self.SendScintilla(scintillacon.SCI_SETMARGINWIDTHN, n, width)
  149. def SCISetFoldFlags(self, flags):
  150. self.SendScintilla(scintillacon.SCI_SETFOLDFLAGS, flags)
  151. # Markers
  152. def SCIMarkerDefineAll(self, markerNum, markerType, fore, back):
  153. self.SCIMarkerDefine(markerNum, markerType)
  154. self.SCIMarkerSetFore(markerNum, fore)
  155. self.SCIMarkerSetBack(markerNum, back)
  156. def SCIMarkerDefine(self, markerNum, markerType):
  157. self.SendScintilla(scintillacon.SCI_MARKERDEFINE, markerNum, markerType)
  158. def SCIMarkerSetFore(self, markerNum, fore):
  159. self.SendScintilla(scintillacon.SCI_MARKERSETFORE, markerNum, fore)
  160. def SCIMarkerSetBack(self, markerNum, back):
  161. self.SendScintilla(scintillacon.SCI_MARKERSETBACK, markerNum, back)
  162. def SCIMarkerAdd(self, lineNo, markerNum):
  163. self.SendScintilla(scintillacon.SCI_MARKERADD, lineNo, markerNum)
  164. def SCIMarkerDelete(self, lineNo, markerNum):
  165. self.SendScintilla(scintillacon.SCI_MARKERDELETE, lineNo, markerNum)
  166. def SCIMarkerDeleteAll(self, markerNum=-1):
  167. self.SendScintilla(scintillacon.SCI_MARKERDELETEALL, markerNum)
  168. def SCIMarkerGet(self, lineNo):
  169. return self.SendScintilla(scintillacon.SCI_MARKERGET, lineNo)
  170. def SCIMarkerNext(self, lineNo, markerNum):
  171. return self.SendScintilla(scintillacon.SCI_MARKERNEXT, lineNo, markerNum)
  172. def SCICancel(self):
  173. self.SendScintilla(scintillacon.SCI_CANCEL)
  174. # AutoComplete
  175. def SCIAutoCShow(self, text):
  176. if type(text) in [type([]), type(())]:
  177. text = ' '.join(text)
  178. buff = (text + "\0").encode(default_scintilla_encoding)
  179. return self.SendScintilla(scintillacon.SCI_AUTOCSHOW, 0, buff)
  180. def SCIAutoCCancel(self):
  181. self.SendScintilla(scintillacon.SCI_AUTOCCANCEL)
  182. def SCIAutoCActive(self):
  183. return self.SendScintilla(scintillacon.SCI_AUTOCACTIVE)
  184. def SCIAutoCComplete(self):
  185. return self.SendScintilla(scintillacon.SCI_AUTOCCOMPLETE)
  186. def SCIAutoCStops(self, stops):
  187. buff = (stops + "\0").encode(default_scintilla_encoding)
  188. self.SendScintilla(scintillacon.SCI_AUTOCSTOPS, 0, buff)
  189. def SCIAutoCSetAutoHide(self, hide):
  190. self.SendScintilla(scintillacon.SCI_AUTOCSETAUTOHIDE, hide)
  191. def SCIAutoCSetFillups(self, fillups):
  192. self.SendScintilla(scintillacon.SCI_AUTOCSETFILLUPS, fillups)
  193. # Call tips
  194. def SCICallTipShow(self, text, pos=-1):
  195. if pos==-1: pos = self.GetSel()[0]
  196. buff = (text + "\0").encode(default_scintilla_encoding)
  197. self.SendScintilla(scintillacon.SCI_CALLTIPSHOW, pos, buff)
  198. def SCICallTipCancel(self):
  199. self.SendScintilla(scintillacon.SCI_CALLTIPCANCEL)
  200. def SCICallTipActive(self):
  201. return self.SendScintilla(scintillacon.SCI_CALLTIPACTIVE)
  202. def SCICallTipPosStart(self):
  203. return self.SendScintilla(scintillacon.SCI_CALLTIPPOSSTART)
  204. def SCINewline(self):
  205. self.SendScintilla(scintillacon.SCI_NEWLINE)
  206. # Lexer etc
  207. def SCISetKeywords(self, keywords, kw_list_no = 0):
  208. buff = (keywords+"\0").encode(default_scintilla_encoding)
  209. self.SendScintilla(scintillacon.SCI_SETKEYWORDS, kw_list_no, buff)
  210. def SCISetProperty(self, name, value):
  211. name_buff = array.array('b', (name + '\0').encode(default_scintilla_encoding))
  212. val_buff = array.array("b", (str(value)+'\0').encode(default_scintilla_encoding))
  213. address_name_buffer = name_buff.buffer_info()[0]
  214. address_val_buffer = val_buff.buffer_info()[0]
  215. self.SendScintilla(scintillacon.SCI_SETPROPERTY, address_name_buffer, address_val_buffer)
  216. def SCISetStyleBits(self, nbits):
  217. self.SendScintilla(scintillacon.SCI_SETSTYLEBITS, nbits)
  218. # Folding
  219. def SCIGetFoldLevel(self, lineno):
  220. return self.SendScintilla(scintillacon.SCI_GETFOLDLEVEL, lineno)
  221. def SCIToggleFold(self, lineno):
  222. return self.SendScintilla(scintillacon.SCI_TOGGLEFOLD, lineno)
  223. def SCIEnsureVisible(self, lineno):
  224. self.SendScintilla(scintillacon.SCI_ENSUREVISIBLE, lineno)
  225. def SCIGetFoldExpanded(self, lineno):
  226. return self.SendScintilla(scintillacon.SCI_GETFOLDEXPANDED, lineno)
  227. # right edge
  228. def SCISetEdgeColumn(self, edge):
  229. self.SendScintilla(scintillacon.SCI_SETEDGECOLUMN, edge)
  230. def SCIGetEdgeColumn(self):
  231. return self.SendScintilla(scintillacon.SCI_GETEDGECOLUMN)
  232. def SCISetEdgeMode(self, mode):
  233. self.SendScintilla(scintillacon.SCI_SETEDGEMODE, mode)
  234. def SCIGetEdgeMode(self):
  235. return self.SendScintilla(scintillacon.SCI_GETEDGEMODE)
  236. def SCISetEdgeColor(self, color):
  237. self.SendScintilla(scintillacon.SCI_SETEDGECOLOUR, color)
  238. def SCIGetEdgeColor(self):
  239. return self.SendScintilla(scintillacon.SCI_GETEDGECOLOR)
  240. # Multi-doc
  241. def SCIGetDocPointer(self):
  242. return self.SendScintilla(scintillacon.SCI_GETDOCPOINTER)
  243. def SCISetDocPointer(self, p):
  244. return self.SendScintilla(scintillacon.SCI_SETDOCPOINTER, 0, p)
  245. def SCISetWrapMode(self, mode):
  246. return self.SendScintilla(scintillacon.SCI_SETWRAPMODE, mode)
  247. def SCIGetWrapMode(self):
  248. return self.SendScintilla(scintillacon.SCI_GETWRAPMODE)
  249. class CScintillaEditInterface(ScintillaControlInterface):
  250. def close(self):
  251. self.colorizer = None
  252. def Clear(self):
  253. self.SendScintilla(win32con.WM_CLEAR)
  254. def Clear(self):
  255. self.SendScintilla(win32con.WM_CLEAR)
  256. def FindText(self, flags, range, findText):
  257. """ LPARAM for EM_FINDTEXTEX:
  258. typedef struct _findtextex {
  259. CHARRANGE chrg;
  260. LPCTSTR lpstrText;
  261. CHARRANGE chrgText;} FINDTEXTEX;
  262. typedef struct _charrange {
  263. LONG cpMin;
  264. LONG cpMax;} CHARRANGE;
  265. """
  266. findtextex_fmt='llPll'
  267. ## Scintilla does not handle unicode in EM_FINDTEXT msg (FINDTEXTEX struct)
  268. txt_buff = (findText+'\0').encode(default_scintilla_encoding)
  269. txt_array = array.array('b', txt_buff)
  270. ft_buff = struct.pack(findtextex_fmt, range[0], range[1], txt_array.buffer_info()[0], 0, 0)
  271. ft_array = array.array('b', ft_buff)
  272. rc = self.SendScintilla(EM_FINDTEXTEX, flags, ft_array.buffer_info()[0])
  273. ftUnpacked = struct.unpack(findtextex_fmt, ft_array)
  274. return rc, (ftUnpacked[3], ftUnpacked[4])
  275. def GetSel(self):
  276. currentPos = self.SendScintilla(scintillacon.SCI_GETCURRENTPOS)
  277. anchorPos = self.SendScintilla(scintillacon.SCI_GETANCHOR)
  278. if currentPos < anchorPos:
  279. return (currentPos, anchorPos)
  280. else:
  281. return (anchorPos, currentPos)
  282. return currentPos;
  283. def GetSelText(self):
  284. start, end = self.GetSel()
  285. txtBuf = array.array('b', null_byte * (end-start+1))
  286. addressTxtBuf = txtBuf.buffer_info()[0]
  287. # EM_GETSELTEXT is documented as returning the number of chars
  288. # not including the NULL, but scintilla includes the NULL. A
  289. # quick glance at the scintilla impl doesn't make this
  290. # obvious - the NULL is included in the 'selection' object
  291. # and reflected in the length of that 'selection' object.
  292. # I expect that is a bug in scintilla and may be fixed by now,
  293. # but we just blindly assume that the last char is \0 and
  294. # strip it.
  295. self.SendScintilla(EM_GETSELTEXT, 0, addressTxtBuf)
  296. return txtBuf.tobytes()[:-1].decode(default_scintilla_encoding)
  297. def SetSel(self, start=0, end=None):
  298. if type(start)==type(()):
  299. assert end is None, "If you pass a point in the first param, the second must be None"
  300. start, end = start
  301. elif end is None:
  302. end = start
  303. if start < 0: start = self.GetTextLength()
  304. if end < 0: end = self.GetTextLength()
  305. assert start <= self.GetTextLength(), "The start postion is invalid (%d/%d)" % (start, self.GetTextLength())
  306. assert end <= self.GetTextLength(), "The end postion is invalid (%d/%d)" % (end, self.GetTextLength())
  307. cr = struct.pack('ll', start, end)
  308. crBuff = array.array('b', cr)
  309. addressCrBuff = crBuff.buffer_info()[0]
  310. rc = self.SendScintilla(EM_EXSETSEL, 0, addressCrBuff)
  311. def GetLineCount(self):
  312. return self.SendScintilla(win32con.EM_GETLINECOUNT)
  313. def LineFromChar(self, charPos=-1):
  314. if charPos==-1: charPos = self.GetSel()[0]
  315. assert charPos >= 0 and charPos <= self.GetTextLength(), "The charPos postion (%s) is invalid (max=%s)" % (charPos, self.GetTextLength())
  316. #return self.SendScintilla(EM_EXLINEFROMCHAR, charPos)
  317. # EM_EXLINEFROMCHAR puts charPos in lParam, not wParam
  318. return self.SendScintilla(EM_EXLINEFROMCHAR, 0, charPos)
  319. def LineIndex(self, line):
  320. return self.SendScintilla(win32con.EM_LINEINDEX, line)
  321. def ScrollCaret(self):
  322. return self.SendScintilla(win32con.EM_SCROLLCARET)
  323. def GetCurLineNumber(self):
  324. return self.LineFromChar(self.SCIGetCurrentPos())
  325. def GetTextLength(self):
  326. return self.SendScintilla(scintillacon.SCI_GETTEXTLENGTH)
  327. def GetTextRange(self, start = 0, end = -1, decode = True):
  328. if end == -1: end = self.SendScintilla(scintillacon.SCI_GETTEXTLENGTH)
  329. assert end>=start, "Negative index requested (%d/%d)" % (start, end)
  330. assert start >= 0 and start <= self.GetTextLength(), "The start postion is invalid"
  331. assert end >= 0 and end <= self.GetTextLength(), "The end postion is invalid"
  332. initer = null_byte * (end - start + 1)
  333. buff = array.array('b', initer)
  334. addressBuffer = buff.buffer_info()[0]
  335. tr = struct.pack('llP', start, end, addressBuffer)
  336. trBuff = array.array('b', tr)
  337. addressTrBuff = trBuff.buffer_info()[0]
  338. num_bytes = self.SendScintilla(EM_GETTEXTRANGE, 0, addressTrBuff)
  339. ret = buff.tobytes()[:num_bytes]
  340. if decode:
  341. ret = ret.decode(default_scintilla_encoding)
  342. return ret
  343. def ReplaceSel(self, str):
  344. buff = (str + "\0").encode(default_scintilla_encoding)
  345. self.SendScintilla(scintillacon.SCI_REPLACESEL, 0, buff)
  346. def GetLine(self, line=-1):
  347. if line == -1: line = self.GetCurLineNumber()
  348. start = self.LineIndex(line)
  349. end = self.LineIndex(line+1)
  350. return self.GetTextRange(start, end)
  351. def SetReadOnly(self, flag = 1):
  352. return self.SendScintilla(win32con.EM_SETREADONLY, flag)
  353. def LineScroll(self, lines, cols=0):
  354. return self.SendScintilla(win32con.EM_LINESCROLL, cols, lines)
  355. def GetFirstVisibleLine(self):
  356. return self.SendScintilla(win32con.EM_GETFIRSTVISIBLELINE)
  357. def SetWordWrap(self, mode):
  358. if mode != win32ui.CRichEditView_WrapNone:
  359. raise ValueError("We dont support word-wrap (I dont think :-)")
  360. class CScintillaColorEditInterface(CScintillaEditInterface):
  361. ################################
  362. # Plug-in colorizer support
  363. def _GetColorizer(self):
  364. if not hasattr(self, "colorizer"):
  365. self.colorizer = self._MakeColorizer()
  366. return self.colorizer
  367. def _MakeColorizer(self):
  368. # Give parent a chance to hook.
  369. parent_func = getattr(self.GetParentFrame(), "_MakeColorizer", None)
  370. if parent_func is not None:
  371. return parent_func()
  372. from . import formatter
  373. ## return formatter.PythonSourceFormatter(self)
  374. return formatter.BuiltinPythonSourceFormatter(self)
  375. def Colorize(self, start=0, end=-1):
  376. c = self._GetColorizer()
  377. if c is not None: c.Colorize(start, end)
  378. def ApplyFormattingStyles(self, bReload=1):
  379. c = self._GetColorizer()
  380. if c is not None: c.ApplyFormattingStyles(bReload)
  381. # The Parent window will normally hook
  382. def HookFormatter(self, parent = None):
  383. c = self._GetColorizer()
  384. if c is not None: # No need if we have no color!
  385. c.HookFormatter(parent)
  386. class CScintillaEdit(window.Wnd, CScintillaColorEditInterface):
  387. def __init__(self, wnd=None):
  388. if wnd is None:
  389. wnd = win32ui.CreateWnd()
  390. window.Wnd.__init__(self, wnd)
  391. def SendScintilla(self, msg, w=0, l=0):
  392. return self.SendMessage(msg, w, l)
  393. def CreateWindow(self, style, rect, parent, id):
  394. self._obj_.CreateWindow(
  395. "Scintilla",
  396. "Scintilla",
  397. style,
  398. rect,
  399. parent,
  400. id,
  401. None)