Skip trailing spaces when using the Insert Code function

Description

When a word is highlighted in a text, browsers will also include any space after the word (presumably to make deleting words in sentences easier). This gives an issue when using the "Insert Code" function, as it will now also include the trailing space in the backticks.

Example. Double click any word in a sentence that is followed by a space (i.e. not the last word), and observe that the space after is highlighted. Click "Insert Code" from the editor tools.

A `word `in a sentence.

Notice how the space after the "word" has been included in the backticks.

Proposal

I propose that when the Insert Code is clicked, it will check the marked text and remove any trailing space. So that the above example becomes.

A `word` in a sentence.

Links / references

Edited Jun 16, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading