Skip to content

Draft: Fix selection when adding a link via shortcut

Peter Leitzen requested to merge pl-fix-add-link-url into master

What does this MR do and why?

Previously, we linking a text which contained the word url we would preselect the first occurrence instead of the last.

Closes #207507.

For example:

Given the following text:

some fancy url

When selecting this text

>some fancy url<

And pressing CTRL+K it would add a link and preselect some fancy >url<:

[some fancy >url<](url)

With this commit we preselect the last occurrence as expected:

[some fancy url](>url<)

Caught during !98505 (comment 1129846238)

Screenshots or screen recordings

Before After
Screenshot_from_2022-10-10_13-27-51 Screenshot_from_2022-10-10_13-28-29

How to set up and validate locally

  1. Open a note in an issue or MR
  2. Type some fancy url
  3. Select the written word
  4. Press CTRL+K or Command+K
  5. Verify preselected url word

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports