from ..action import QAction as QAction
from ..document import QTextDocumentEx as QTextDocumentEx, QTextEditChange as QTextEditChange
from ..menu import QRoundMenu as QRoundMenu
from ..qt import QApplication as QApplication, QContextMenuEvent as QContextMenuEvent, QEvent as QEvent, QFont as QFont, QIcon as QIcon, QInputMethodEvent as QInputMethodEvent, QKeyEvent as QKeyEvent, QKeySequence as QKeySequence, QObject as QObject, QPlainTextEdit as QPlainTextEdit, QPoint as QPoint, QRect as QRect, QRegularExpression as QRegularExpression, QTextBlock as QTextBlock, QTextCharFormat as QTextCharFormat, Qt as Qt, Signal as Signal
from ..scrollbar import QScrollDelegate as QScrollDelegate
from ..textcursor import QTextDocumentCursor as QTextDocumentCursor
from ..theme import QIconProvider as QIconProvider, QTheme as QTheme
from .extension import QCodeExtension as QCodeExtension, QCodePanel as QCodePanel
from .extensions.decorator import Decorator as Decorator
from .extensions.edgelinefloatingpanel import EdgeLinePanel as EdgeLinePanel
from .extensions.findreplacepanel import FindReplacePanel as FindReplacePanel
from .extensions.linenumberpanel import LineNumbersPanel as LineNumbersPanel
from .features import PLAIN_TEXT_FEATURES as PLAIN_TEXT_FEATURES, QLanguageFeatures as QLanguageFeatures
from .scheme import LIGHT as LIGHT, QCodeScheme as QCodeScheme
from _typeshed import Incomplete
from qtpy import QtGui
from typing import Callable

def matchCount(pattern: str, sourceText: str, matchCase: bool = False, matchWords: bool = False, isRegex: bool = False): ...

class PanelsLayoutManager(QObject):
    editor: QCodeEditor
    def __init__(self, editor: QCodeEditor) -> None: ...
    def destroy(self) -> None: ...
    def add(self, panel: QCodePanel): ...
    def layout(self) -> None: ...
    def alignHorizontallScrollFollowerWithContent(self) -> None: ...
    def update(self, rect: QRect = None, dy: int = 0): ...
    def eventFilter(self, watched: QObject, event: QEvent) -> bool: ...

class TextEditControl:
    editor: QCodeEditor
    def __init__(self, editor: QCodeEditor) -> None: ...
    def replaceSelectedText(self, text: str, selection: QTextDocumentCursor, pattern: str = None): ...
    def replaceTextAll(self, pattern: str, text: str, matchCase: bool = False, matchWords: bool = False, isRegex: bool = False): ...
    def removeSelectedText(self, cursor: QTextDocumentCursor): ...
    def insertText(self, text: str, cursor: QTextDocumentCursor, *, format: QTextCharFormat = None): ...
    def deletePreviousChar(self, cursor: QTextDocumentCursor): ...
    def deleteNextChar(self, cursor: QTextDocumentCursor): ...
    def clear(self) -> None: ...
    def undentHeadingBlanks(self, cursor: QTextDocumentCursor): ...
    def closeAutoClosingPair(self, cursor: QTextDocumentCursor, text: str) -> bool: ...
    def uncloseAutoClosingPair(self, cursor: QTextDocumentCursor) -> bool: ...
    def closeAutoSurroundingPair(self, cursor: QTextDocumentCursor, text: str) -> bool: ...
    def toggleComment(self, cursor: QTextDocumentCursor): ...
    def indent(self, cursor: QTextDocumentCursor): ...
    def unindent(self, cursor: QTextDocumentCursor): ...
    def moveHomeOfBlock(self, cursor: QTextDocumentCursor): ...
    def smartEnter(self, cursor: QTextDocumentCursor): ...

class Jump(Exception): ...

class QCodeEditor(QPlainTextEdit):
    readOnlyChanged: Incomplete
    def installExtension(self, name: str, provider: Callable[[QCodeEditor], QCodeExtension]): ...
    def extension(self, name: str) -> QCodeExtension | None: ...
    def extensions(self) -> list[QCodeExtension]: ...
    def update(self) -> None: ...
    def resizeEvent(self, event) -> None: ...
    schemeChanged: Incomplete
    def scheme(self) -> QCodeScheme: ...
    def setScheme(self, scheme: QCodeScheme): ...
    contentScrolled: Incomplete
    def scrollContentsBy(self, dx: int, dy: int): ...
    def setDocument(self, document: QTextDocumentEx): ...
    def document(self) -> QTextDocumentEx: ...
    def characterCount(self) -> int: ...
    def textCursor(self, from_: int | tuple[int, int] | QPoint = None, to_: int | tuple[int, int] | QPoint = None) -> QTextDocumentCursor: ...
    def visibleBlocksRange(self) -> tuple[int, int]: ...
    def visibleBlocks(self) -> list[tuple[tuple[float, float], QTextBlock]]: ...
    def setText(self, text: str): ...
    def toText(self) -> str: ...
    def setReadOnly(self, ro: bool): ...
    def positionsOfCursor(self, cursor: QTextDocumentCursor | QtGui.QTextCursor) -> tuple[int, tuple[int, int], int, tuple[int, int]]: ...
    def replaceSelectedText(self, text: str, selection: QTextDocumentCursor, pattern: str = None): ...
    def replaceTextAll(self, pattern: str, text: str, matchCase: bool = False, matchWords: bool = False, isRegex: bool = False): ...
    def keyPressEvent(self, event: QKeyEvent): ...
    def inputMethodEvent(self, event: QInputMethodEvent): ...
    def undo(self) -> None: ...
    def redo(self) -> None: ...
    def paste(self) -> None: ...
    def cut(self) -> None: ...
    def clear(self) -> None: ...
    def findText(self, text: str, newSearch: bool = False, forward: bool = True, matchCase: bool = False, matchWords: bool = False, isRegex: bool = False) -> int: ...
    def findOccurrences(self, text: str, from_: QTextDocumentCursor = None, to_: QTextDocumentCursor = None, matchCase: bool = False, matchWords: bool = False, isRegex: bool = False, *, limits=None) -> list[QTextDocumentCursor]: ...
    def matchCount(self, text: str, matchCase: bool = False, matchWords: bool = False, isRegex: bool = False, toCursor: QTextDocumentCursor = None) -> int: ...
    def setIntelligentBackspaceEnabled(self, enable: bool): ...
    def isIntelligentBackspaceEnabled(self) -> bool: ...
    def setAutoClosingEnabled(self, enable: bool): ...
    def isAutoClosingEnabled(self) -> bool: ...
    def setAutoSurroundingEnabled(self, enable: bool): ...
    def isAutoSurroundingEnabled(self) -> bool: ...
    tabStopWidthSpacesChanged: Incomplete
    def tabStopWidthSpaces(self) -> int: ...
    def setTabStopWidthSpaces(self, width: int): ...
    def setUsingSpacesOverTab(self, enable: bool): ...
    def isUsingSpacesOverTab(self) -> bool: ...
    def indentationAtCursor(self, cursor: QTextDocumentCursor) -> int: ...
    def indentationOfBlock(self, blockno: int) -> int: ...
    def indentation2Text(self, indentation: int) -> str: ...
    def setFont(self, font: QFont): ...
    def contextMenuEvent(self, e: QContextMenuEvent): ...
    def __init__(self, parent=None, document: QTextDocumentEx = None, features: QLanguageFeatures = ...) -> None: ...
