Make it easier to check on or off the checkbox by adding some buffer (instead of having to precisely click inside it)

This commit is contained in:
Miguel Jacq 2025-11-28 14:22:18 +11:00
parent a56d6512d3
commit 4029d7604e
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
2 changed files with 10 additions and 1 deletions

View file

@ -3,6 +3,7 @@
* Prevent triple-click select from selecting the list item (e.g checkbox, bullet)
* Use DejaVu Sans font for regular text instead of heavier Noto - might help with the freeze issues.
* Change History icon (again)
* Make it easier to check on or off the checkbox by adding some buffer (instead of having to precisely click inside it)
# 0.5.2

View file

@ -960,7 +960,15 @@ class MarkdownEditor(QTextEdit):
doc_pos = block.position() + i
r = char_rect_at(doc_pos, icon)
if r.contains(pt):
# ---------- Relax the hit area here ----------
# Expand the clickable area horizontally so you don't have to
# land exactly on the glyph. This makes the "checkbox zone"
# roughly 3× the glyph width, centered on it.
pad = r.width() # one glyph width on each side
hit_rect = r.adjusted(-pad, 0, pad, 0)
# ---------------------------------------------
if hit_rect.contains(pt):
# Build the replacement: swap ☐ <-> ☑ (keep trailing space)
new_icon = (
self._CHECK_CHECKED_DISPLAY