Toggle highlight breaks checkboxes if whole of line selected

Steps to reproduce

Case 1

  • create a checkbox list, mixture of un/completed
  • select a number of checkbox lines
    • i.e. mouse-drag select
  • Ctrl+P, Toggle highlight

Case 2

  • create a checkbox list, mixture of un/completed
  • in vim mode, select one ore more entire lines with Shift-V
  • Ctrl+P, Toggle highlight

Did you follow the troubleshooting guide? [Y/N]

Issue occurs in the sandbox vault, yes.

Expected result

The == are added after the [ ] or [x], preserving the checkbox syntax.

Actual result

The == are added before the [ ] or [x], breaking the checkbox syntax

Environment

SYSTEM INFO:
	Obsidian version: v1.5.12
	Installer version: v1.5.12
	Operating system: Windows 10 Enterprise 10.0.19044
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

In the sandbox vault, when using Toggle Highlight ON within a list containing chekboxes, the resulting == are added before the [ ] or [x], breaking the checkboxes.

This issue does not occur if I select only the non-checkbox portion of each line

  • e.g. with cursor at end of line, press Shift+Home, selection stops before the closing ]

motivation

I keep a rolling weekly list of to-dos, so each Monday I copy last week’s note, deleting the completed items. Often a task might sit without updates for a while and I want to skim over these.

I’d like to (ab)use the highlight function and a CSS snippet to de-emphasise such ongoing items, which means I want to select multiple lines at once and toggle highlighting on all of them.

I did try working around this with a vim-mode s/// but have had issues with replacing groups (I just get \1\2 dumped out)

outofrange error

Perhaps a topic for a separate bug report, if I try to toggle OFF highlighting on a line including escaped double-equals (\==) then the console reports

Uncaught RangeError: Selection points outside of document

e.g. ==words containing \== equals==

obsidian_range_error

Thanks!