Skip to content

ScintillaEdit

Bases: ScintillaEditFixed

The Scintilla editing widget, with one typed method per Scintilla message.

Each SCI_* message in Scintilla's documentation maps to a method by one rule (each method's docstring names its message and any difference):

  • the name drops SCI_ and is camelCased (SCI_ADDTEXT -> addText, getters also drop Get: SCI_GETLEXERLANGUAGE -> lexerLanguage);
  • char * text is str, in the document's encoding; raw data (style bytes, images) is bytes;
  • colours are QColor, not Scintilla's packed 0xBBGGRR (or 0xAABBGGRR) ints -- an int still converts, but as Qt's 0xRRGGBB, like everywhere in PySide6;
  • a length argument that only measures the string argument is dropped;
  • a result buffer is returned instead of passed in;
  • positions and lengths stay byte counts, as in Scintilla -- use getBytes() where byte offsets matter.

A real subclass rather than an import alias, so type checkers (and "go to definition") report this class's own name instead of the underlying ScintillaEditFixed binding class -- see docs/pyside6-scintilla/bindings.md for why that class exists.

annotationSetText(line, text)

Set the annotation text for a line; None clears it (SCI_ANNOTATIONSETTEXT with NULL).

eOLAnnotationSetText(line, text)

Set the end of line annotation text for a line; None clears it (SCI_EOLANNOTATIONSETTEXT with NULL).

get_doc()

Return a new ScintillaDocument wrapping this editor's current document.

Pass it to another ScintillaEdit's set_doc to share the document between views.

The returned object has no Qt parent, so it's kept alive only by your Python reference to it -- if you let it go, its modified/save_point/etc. signals stop firing (the underlying document itself stays alive as long as an editor is using it).

marginSetText(line, text)

Set the text in the text margin for a line; None clears it (SCI_MARGINSETTEXT with NULL).