More test coverage, remove unused functions from editor.py

This commit is contained in:
Miguel Jacq 2025-11-07 11:13:04 +11:00
parent ada1d8ffad
commit 66950eeff5
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
6 changed files with 301 additions and 18 deletions

View file

@ -271,16 +271,6 @@ class Editor(QTextEdit):
cur.endEditBlock()
self.viewport().update()
def _safe_select(self, cur: QTextCursor, start: int, end: int):
"""Select [start, end] inclusive without exceeding document bounds."""
doc_max = max(0, self.document().characterCount() - 1)
s = max(0, min(start, doc_max))
e = max(0, min(end, doc_max))
if e < s:
s, e = e, s
cur.setPosition(s)
cur.setPosition(e, QTextCursor.KeepAnchor)
def _trim_url_end(self, url: str) -> str:
# strip common trailing punctuation not part of the URL
trimmed = url.rstrip(".,;:!?\"'")
@ -854,14 +844,6 @@ class Editor(QTextEdit):
break
b = b.next()
def toggle_current_checkbox_state(self):
"""Tick/untick the current line if it starts with a checkbox."""
b = self.textCursor().block()
state, _ = self._checkbox_info_for_block(b)
if state is None:
return
self._set_block_checkbox_state(b, not state)
@Slot()
def apply_weight(self):
cur = self.currentCharFormat()