# eric4.QScintilla.QsciScintillaCompat

Module implementing a compatability interface class to QsciScintilla.

### Global Attributes

None

### Classes

QsciScintillaCompat | Class implementing a compatability interface to QsciScintilla.

### Functions

QSCINTILLA_VERSION | Module function to return the QScintilla version.

## QsciScintillaCompat

Class implementing a compatability interface to QsciScintilla.

This class implements all the functions, that were added to QsciScintilla incrementally. This class ensures compatibility to older versions of QsciScintilla.

### Derived from

QsciScintilla

### Class Attributes

UserSeparator

### Methods

QsciScintillaCompat | Constructor
__doSearchTarget | Private method to perform the search in target.
charAt | Public method to get the character at a position in the text observing multibyte characters.
clearAllIndicators | Public method to clear all occurrences of an indicator.
clearAlternateKeys | Protected method to clear the alternate key commands.
clearIndicator | Public method to clear an indicator for the given range.
clearIndicatorRange | Public method to clear an indicator for the given range.
clearKeys | Protected method to clear the key commands.
clearStyles | Public method to set the styles according the selected Qt style.
currentPosition | Public method to get the current position.
currentStyle | Public method to get the style at the current position.
delete | Public method to delete the character to the right of the cursor.
deleteBack | Public method to delete the character to the left of the cursor.
deleteLineLeft | Public method to delete the line to the left of the cursor.
deleteLineRight | Public method to delete the line to the right of the cursor.
deleteWordLeft | Public method to delete the word to the left of the cursor.
deleteWordRight | Public method to delete the word to the right of the cursor.
detectEolString | Public method to determine the eol string used.
editorCommand | Public method to perform a simple editor command.
extendSelectionLeft | Public method to extend the selection one character to the left.
extendSelectionRight | Public method to extend the selection one character to the right.
extendSelectionToBOL | Public method to extend the selection to the beginning of the line.
extendSelectionToEOL | Public method to extend the selection to the end of the line.
extendSelectionWordLeft | Public method to extend the selection one word to the left.
extendSelectionWordRight | Public method to extend the selection one word to the right.
findFirstTarget | Public method to search in a specified range of text without setting the selection.
findNextTarget | Public method to find the next occurrence in the target range.
focusOutEvent | Public method called when the editor loses focus.
foldExpandedAt | Public method to determine, if a fold is expanded.
foldFlagsAt | Public method to get the fold flags of a line of the document.
foldHeaderAt | Public method to determine, if a line of the document is a fold header line.
foldLevelAt | Public method to get the fold level of a line of the document.
getCursorFlashTime | Public method to get the flash (blink) time of the cursor in milliseconds.
getEndStyled | Public method to get the last styled position.
getEolIndicator | Public method to get the eol indicator for the current eol mode.
getFileName | Public method to return the name of the file being displayed.
getFoundTarget | Public method to get the recently found target.
getLineSeparator | Public method to get the line separator for the current eol mode.
getZoom | Public method used to retrieve the current zoom factor.
hasIndicator | Public method to test for the existence of an indicator.
indentationGuideView | Public method to get the indentation guide view.
indicatorDefine | Public method to define the appearance of an indicator.
lineAt | Public method to calculate the line at a position.
lineEndPosition | Public method to determine the line end position of the given line.
lineIndexFromPosition | Public method to convert an absolute position to line and index.
linesOnScreen | Public method to get the amount of visible lines.
monospacedStyles | Public method to set the current style to be monospaced.
moveCursorLeft | Public method to move the cursor left.
moveCursorRight | Public method to move the cursor right.
moveCursorToEOL | Public method to move the cursor to the end of line.
moveCursorWordLeft | Public method to move the cursor left one word.
moveCursorWordRight | Public method to move the cursor right one word.
newLineBelow | Public method to insert a new line below the current one.
positionAfter | Public method to get the position after the given position taking into account multibyte characters.
positionBefore | Public method to get the position before the given position taking into account multibyte characters.
positionFromLineIndex | Public method to convert line and index to an absolute position.
positionFromPoint | Public method to calculate the scintilla position from a point in the window.
rawCharAt | Public method to get the raw character at a position in the text.
replaceTarget | Public method to replace the string found by the last search in target.
scrollVertical | Public method to scroll the text area.
setCurrentIndicator | Public method to set the current indicator.
setCursorFlashTime | Public method to get the flash (blink) time of the cursor in milliseconds.
setEolModeByEolString | Public method to set the eol mode given the eol string.
setIndentationGuideView | Public method to set the view of the indentation guides.
setIndicator | Public method to set an indicator for the given range.
setIndicatorRange | Public method to set an indicator for the given range.
setLexer | Public method to set the lexer.
setStyleBits | Public method to set the number of bits to be used for styling.
setStyling | Public method to style some text.
showUserList | Public method to show a user supplied list.
startStyling | Public method to prepare styling.
styleAt | Public method to get the style at a position in the text.
zoomIn | Public method used to increase the zoom factor.
zoomOut | Public method used to decrease the zoom factor.
zoomTo | Public method used to zoom to a specific zoom factor.

#### QsciScintillaCompat (Constructor)

QsciScintillaCompat(parent = None)

Constructor

parent
  parent widget (QWidget)
name
  name of this instance (string or QString)
flags
  window flags

#### QsciScintillaCompat.__doSearchTarget

__doSearchTarget()

Private method to perform the search in target.

Returns:
  flag indicating a successful search (boolean)

#### QsciScintillaCompat.charAt

charAt(pos)

Public method to get the character at a position in the text observing multibyte characters.

pos
  position in the text (integer)

Returns:
  raw character at the requested position or empty string, if the position is negative or past the end of the document (string)

#### QsciScintillaCompat.clearAllIndicators

clearAllIndicators(indicator)

Public method to clear all occurrences of an indicator.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)

#### QsciScintillaCompat.clearAlternateKeys

clearAlternateKeys()

Protected method to clear the alternate key commands.

#### QsciScintillaCompat.clearIndicator

clearIndicator(indicator, sline, sindex, eline, eindex)

Public method to clear an indicator for the given range.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
sline
  line number of the indicator start (integer)
sindex
  index of the indicator start (integer)
eline
  line number of the indicator end (integer)
eindex
  index of the indicator end (integer)

#### QsciScintillaCompat.clearIndicatorRange

clearIndicatorRange(indicator, spos, length)

Public method to clear an indicator for the given range.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
spos
  position of the indicator start (integer)
length
  length of the indicator (integer)

#### QsciScintillaCompat.clearKeys

clearKeys()

Protected method to clear the key commands.

#### QsciScintillaCompat.clearStyles

clearStyles()

Public method to set the styles according the selected Qt style.

#### QsciScintillaCompat.currentPosition

currentPosition()

Public method to get the current position.

Returns:
  absolute position of the cursor (integer)

#### QsciScintillaCompat.currentStyle

currentStyle()

Public method to get the style at the current position.

Returns:
  style at the current position (integer)

#### QsciScintillaCompat.delete

delete()

Public method to delete the character to the right of the cursor.

#### QsciScintillaCompat.deleteBack

deleteBack()

Public method to delete the character to the left of the cursor.

#### QsciScintillaCompat.deleteLineLeft

deleteLineLeft()

Public method to delete the line to the left of the cursor.

#### QsciScintillaCompat.deleteLineRight

deleteLineRight()

Public method to delete the line to the right of the cursor.

#### QsciScintillaCompat.deleteWordLeft

deleteWordLeft()

Public method to delete the word to the left of the cursor.

#### QsciScintillaCompat.deleteWordRight

deleteWordRight()

Public method to delete the word to the right of the cursor.

#### QsciScintillaCompat.detectEolString

detectEolString(txt)

Public method to determine the eol string used.

txt
  text from which to determine the eol string (string)

Returns:
  eol string (string)

#### QsciScintillaCompat.editorCommand

editorCommand(cmd)

Public method to perform a simple editor command.

cmd
  the scintilla command to be performed

#### QsciScintillaCompat.extendSelectionLeft

extendSelectionLeft()

Public method to extend the selection one character to the left.

#### QsciScintillaCompat.extendSelectionRight

extendSelectionRight()

Public method to extend the selection one character to the right.

#### QsciScintillaCompat.extendSelectionToBOL

extendSelectionToBOL()

Public method to extend the selection to the beginning of the line.

#### QsciScintillaCompat.extendSelectionToEOL

extendSelectionToEOL()

Public method to extend the selection to the end of the line.

#### QsciScintillaCompat.extendSelectionWordLeft

extendSelectionWordLeft()

Public method to extend the selection one word to the left.

#### QsciScintillaCompat.extendSelectionWordRight

extendSelectionWordRight()

Public method to extend the selection one word to the right.

#### QsciScintillaCompat.findFirstTarget

findFirstTarget(expr_, re_, cs_, wo_, begline = -1, begindex = -1, endline = -1, endindex = -1, ws_ = False)

Public method to search in a specified range of text without setting the selection.

expr_
  search expression (string or QString)
re_
  flag indicating a regular expression (boolean)
cs_
  flag indicating a case sensitive search (boolean)
wo_
  flag indicating a word only search (boolean)
begline=
  line number to start from (-1 to indicate current position) (integer)
begindex=
  index to start from (-1 to indicate current position) (integer)
endline=
  line number to stop at (-1 to indicate end of document) (integer)
endindex=
  index number to stop at (-1 to indicate end of document) (integer)
ws_=
  flag indicating a word start search (boolean)

Returns:
  flag indicating a successful search (boolean)

#### QsciScintillaCompat.findNextTarget

findNextTarget()

Public method to find the next occurrence in the target range.

Returns:
  flag indicating a successful search (boolean)

#### QsciScintillaCompat.focusOutEvent

focusOutEvent(event)

Public method called when the editor loses focus.

event
  the event object (QFocusEvent)

#### QsciScintillaCompat.foldExpandedAt

foldExpandedAt(line)

Public method to determine, if a fold is expanded.

line
  line number (integer)

Returns:
  flag indicating the fold expansion state of the line (boolean)

#### QsciScintillaCompat.foldFlagsAt

foldFlagsAt(line)

Public method to get the fold flags of a line of the document.

line
  line number (integer)

Returns:
  fold flags of the given line (integer)

#### QsciScintillaCompat.foldHeaderAt

foldHeaderAt(line)

Public method to determine, if a line of the document is a fold header line.

line
  line number (integer)

Returns:
  flag indicating a fold header line (boolean)

#### QsciScintillaCompat.foldLevelAt

foldLevelAt(line)

Public method to get the fold level of a line of the document.

line
  line number (integer)

Returns:
  fold level of the given line (integer)

#### QsciScintillaCompat.getCursorFlashTime

getCursorFlashTime()

Public method to get the flash (blink) time of the cursor in milliseconds.

The flash time is the time required to display, invert and restore the caret display. Usually the text cursor is displayed for half the cursor flash time, then hidden for the same amount of time.

Returns:
  flash time of the cursor in milliseconds (integer)

#### QsciScintillaCompat.getEndStyled

getEndStyled()

Public method to get the last styled position.

#### QsciScintillaCompat.getEolIndicator

getEolIndicator()

Public method to get the eol indicator for the current eol mode.

Returns:
  eol indicator (string)

#### QsciScintillaCompat.getFileName

getFileName()

Public method to return the name of the file being displayed.

Returns:
  filename of the displayed file (QString)

#### QsciScintillaCompat.getFoundTarget

getFoundTarget()

Public method to get the recently found target.

Returns:
  found target as a tuple of starting position and target length (integer, integer)

#### QsciScintillaCompat.getLineSeparator

getLineSeparator()

Public method to get the line separator for the current eol mode.

Returns:
  eol string (string)

#### QsciScintillaCompat.getZoom

getZoom()

Public method used to retrieve the current zoom factor.

Returns:
  zoom factor (int)

#### QsciScintillaCompat.hasIndicator

hasIndicator(indicator, pos)

Public method to test for the existence of an indicator.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
pos
  position to test (integer)

Returns:
  flag indicating the existence of the indicator (boolean)

#### QsciScintillaCompat.indentationGuideView

indentationGuideView()

Public method to get the indentation guide view.

Returns:
  indentation guide view (SC_IV_NONE, SC_IV_REAL, SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)

#### QsciScintillaCompat.indicatorDefine

indicatorDefine(indicator, style, color)

Public method to define the appearance of an indicator.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
style
  style to be used for the indicator (QsciScintilla.INDIC_PLAIN, QsciScintilla.INDIC_SQUIGGLE, QsciScintilla.INDIC_TT, QsciScintilla.INDIC_DIAGONAL, QsciScintilla.INDIC_STRIKE, QsciScintilla.INDIC_HIDDEN, QsciScintilla.INDIC_BOX, QsciScintilla.INDIC_ROUNDBOX)
color
  color to be used by the indicator (QColor)

Raises ValueError:
  the indicator or style are not valid

#### QsciScintillaCompat.lineAt

lineAt(pos)

Public method to calculate the line at a position.

This variant is able to calculate the line for positions in the margins and for empty lines.

pos
  position to calculate the line for (integer or QPoint)

Returns:
  linenumber at position or -1, if there is no line at pos (integer, zero based)

#### QsciScintillaCompat.lineEndPosition

lineEndPosition(line)

Public method to determine the line end position of the given line.

line
  line number (integer)

Returns:
  position of the line end disregarding line end characters (integer)

#### QsciScintillaCompat.lineIndexFromPosition

lineIndexFromPosition(pos)

Public method to convert an absolute position to line and index.

pos
  absolute position in the editor (integer)

Returns:
  tuple of line number (integer) and index number (integer)

#### QsciScintillaCompat.linesOnScreen

linesOnScreen()

Public method to get the amount of visible lines.

Returns:
  amount of visible lines (integer)

#### QsciScintillaCompat.monospacedStyles

monospacedStyles(font)

Public method to set the current style to be monospaced.

font
  font to be used (QFont)

#### QsciScintillaCompat.moveCursorLeft

moveCursorLeft()

Public method to move the cursor left.

#### QsciScintillaCompat.moveCursorRight

moveCursorRight()

Public method to move the cursor right.

#### QsciScintillaCompat.moveCursorToEOL

moveCursorToEOL()

Public method to move the cursor to the end of line.

#### QsciScintillaCompat.moveCursorWordLeft

moveCursorWordLeft()

Public method to move the cursor left one word.

#### QsciScintillaCompat.moveCursorWordRight

moveCursorWordRight()

Public method to move the cursor right one word.

#### QsciScintillaCompat.newLineBelow

newLineBelow()

Public method to insert a new line below the current one.

#### QsciScintillaCompat.positionAfter

positionAfter(pos)

Public method to get the position after the given position taking into account multibyte characters.

pos
  position (integer)

Returns:
  position after the given one (integer)

#### QsciScintillaCompat.positionBefore

positionBefore(pos)

Public method to get the position before the given position taking into account multibyte characters.

pos
  position (integer)

Returns:
  position before the given one (integer)

#### QsciScintillaCompat.positionFromLineIndex

positionFromLineIndex(line, index)

Public method to convert line and index to an absolute position.

line
  line number (integer)
index
  index number (integer)

Returns:
  absolute position in the editor (integer)

#### QsciScintillaCompat.positionFromPoint

positionFromPoint(point)

Public method to calculate the scintilla position from a point in the window.

point
  point in the window (QPoint)

Returns:
  scintilla position (integer) or -1 to indicate, that the point is not near any character

#### QsciScintillaCompat.rawCharAt

rawCharAt(pos)

Public method to get the raw character at a position in the text.

pos
  position in the text (integer)

Returns:
  raw character at the requested position or empty string, if the position is negative or past the end of the document (string)

#### QsciScintillaCompat.replaceTarget

replaceTarget(replaceStr)

Public method to replace the string found by the last search in target.

replaceStr
  replacement string or regexp (string or QString)

#### QsciScintillaCompat.scrollVertical

scrollVertical(lines)

Public method to scroll the text area.

lines
  number of lines to scroll (negative scrolls up, positive scrolls down) (integer)

#### QsciScintillaCompat.setCurrentIndicator

setCurrentIndicator(indicator)

Public method to set the current indicator.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)

Raises ValueError:
  the indicator or style are not valid

#### QsciScintillaCompat.setCursorFlashTime

setCursorFlashTime(time)

Public method to get the flash (blink) time of the cursor in milliseconds.

The flash time is the time required to display, invert and restore the caret display. Usually the text cursor is displayed for half the cursor flash time, then hidden for the same amount of time.

time
  flash time of the cursor in milliseconds (integer)

#### QsciScintillaCompat.setEolModeByEolString

setEolModeByEolString(eolStr)

Public method to set the eol mode given the eol string.

eolStr
  eol string (string)

#### QsciScintillaCompat.setIndentationGuideView

setIndentationGuideView(view)

Public method to set the view of the indentation guides.

view
  view of the indentation guides (SC_IV_NONE, SC_IV_REAL, SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)

#### QsciScintillaCompat.setIndicator

setIndicator(indicator, sline, sindex, eline, eindex)

Public method to set an indicator for the given range.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
sline
  line number of the indicator start (integer)
sindex
  index of the indicator start (integer)
eline
  line number of the indicator end (integer)
eindex
  index of the indicator end (integer)

Raises ValueError:
  the indicator or style are not valid

#### QsciScintillaCompat.setIndicatorRange

setIndicatorRange(indicator, spos, length)

Public method to set an indicator for the given range.

indicator
  number of the indicator (integer, QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
spos
  position of the indicator start (integer)
length
  length of the indicator (integer)

Raises ValueError:
  the indicator or style are not valid

#### QsciScintillaCompat.setLexer

setLexer(lex = None)

Public method to set the lexer.

lex
  the lexer to be set or None to reset it.

#### QsciScintillaCompat.setStyleBits

setStyleBits(bits)

Public method to set the number of bits to be used for styling.

#### QsciScintillaCompat.setStyling

setStyling(length, style)

Public method to style some text.

length
  length of text to style (integer)
style
  style to set for text (integer)

#### QsciScintillaCompat.showUserList

showUserList(id, lst)

Public method to show a user supplied list.

id
  id of the list (integer)
lst
  list to be show (QStringList)

#### QsciScintillaCompat.startStyling

startStyling(pos, mask)

Public method to prepare styling.

pos
  styling positition to start at (integer)
mask
  mask of bits to use for styling (integer)

#### QsciScintillaCompat.styleAt

styleAt(pos)

Public method to get the style at a position in the text.

pos
  position in the text (integer)

Returns:
  style at the requested position or 0, if the position is negative or past the end of the document (integer)

#### QsciScintillaCompat.zoomIn

zoomIn(zoom = 1)

Public method used to increase the zoom factor.

zoom
  zoom factor increment

#### QsciScintillaCompat.zoomOut

zoomOut(zoom = 1)

Public method used to decrease the zoom factor.

zoom
  zoom factor decrement

#### QsciScintillaCompat.zoomTo

zoomTo(zoom)

Public method used to zoom to a specific zoom factor.

zoom
  zoom factor

Up

## QSCINTILLA_VERSION

QSCINTILLA_VERSION()

Module function to return the QScintilla version.

If the installed QScintilla is a snapshot version, then assume it is of the latest release and return a version number of 0x99999.

Returns:
  QScintilla version (integer)

Up