Repository navigation
Description
Description
With hanging indentation enabled, valid Markdown links in a longer list-based note can fail to respond to Ctrl-hover highlighting and Ctrl-click opening. Removing unrelated list items can make the same link work again; the link syntax itself is valid.
Expected behavior
Ctrl-hover and Ctrl-click should recognize the link at its displayed position, regardless of wrapping in preceding list items.
Observed behavior and reproduction status
- Enable hanging indentation for Markdown lists.
- Open an affected note containing wrapped list items followed by a Markdown link.
- Ctrl-hover or Ctrl-click the displayed link: highlighting and opening fail.
- Removing other list items can make the problem disappear.
The reporter supplied a reduced private note and confirmed that building the patched current source fixes the original issue. The private note is intentionally not published. A portable manual Markdown reproducer has not yet been confirmed: the synthetic examples tried by the reporter did not reproduce the failure in their configuration.
Technical findings and fix
QMarkdownTextEdit temporarily applies hanging indentation while painting. Narrower continuation lines can add visual lines and move subsequent blocks. Calls to QPlainTextEdit::cursorForPosition() outside that temporary layout can therefore map the visible link position to a different text position or block.
Use the same temporary hanging-indent layout when hit-testing viewport positions, then restore the original layout. This also makes the derived editor's Ctrl-hover highlighting and Ctrl-click validation use the rendered geometry.
Validation
- The reporter confirmed that the fix resolves the original issue after building current source.
- Synthetic automated regression tests cover link hit-testing and Ctrl-click signals with and without a scrollbar, and restoration of the original layout. These tests contain only generic text and
example.orgURLs. just nix-buildsucceeds.- The full unit test suite passes with Qt 6.11.2 on Linux using the minimal platform plugin.
The reporter's exact application version, font, and display configuration have not been recorded. The locally validated source version is 26.11.10.
Activity
pbek/QOwnNotes#3853 editor: hit-test links with hanging indentation
#3853 editor: fix link detection with hanging indentation