It would be nice to have this fixed. Yes, you can split and recombine lines, or type the whole line first and then add the link after. But it’s a pain sometimes.
In addition to not being able to continue typing a line after a link, I’ve noticed that if you put the cursor at the end of a word that precedes a link (separated by a space), and type text, the text becomes part of the preceding word as expected. But if you type a space, the space and following characters goes into the link text - even though there was a space between the cursor and the link. So it’s not possible to insert a word before a link either.
It seems like at least part of this problem is the question of what the user intends, when they place the cursor at the beginning or end of a link in a WYSIWYG editor, and start typing. It may be ambiguous as to whether they want to change the link text, or start a separate word. It appears that Legend always assumes the former, even if the user types a space at the end of the link, or even types a space before the space in front of a link (which seems really like a bug). Another part of the problem is that if you have “show markdown formatting” on, the behaviour seems bizarre and exasperating because it’s doing what it would if you weren’t showing it - you put the cursor after the last round bracket, but your typing goes inside the square brackets…
I looked at some other editors, for example, Apple’s TextEdit and Notes apps, as well as Libre Office (on Mac anyway) just don’t let you add characters to the beginning or end of link text, they won’t be part of the link. It’s simple, but not intuitive when you actually want to change the link text. You can move the cursor inside it with the arrow keys and add text there, but not at the ends. In LibreOffice you can also press command-K and add it in a popup. In Apple’s Pages app, you can’t move the cursor inside the link text. You can only click on it, and then you’re given a popup with the choice of whether to open or edit the link.
Thunderbird’s e-mail composer has relatively complex behaviour, and keeps track of how the cursor got to be at the beginning or end of a link. You can click to place the cursor at either end of a link, and it will or won’t edit the link, depending on the precise place you clicked: clicking on the left half of the first character of the link will place the cursor before it and edit the link, while clicking on the right half of the space before the first character will place the cursor in the same spot, but not edit the link. Placing the cursor outside the link and using the arrow keys to move it to just before the first character will not edit the link, but placing it inside the link and moving it to the same spot will. If a link is the last thing on a line, clicking to the right of the line will place the cursor at the end and not edit the link. Clicking inside the link and moving to the end with the arrow key will edit it, although pressing the arrow key a second time at the end won’t edit the link, even though the cursor didn’t move. This all works well if you’re aware of it, though it’s maybe hard to discover. Even then, it’s fairly intuitive.
I’m not sure what’s best for Legend. Certainly if you have “show markdown formatting” on, there’s no ambiguity, and it should behave how you’d expect, and not be typing characters in a place where the cursor is not…
If you don’t have “show markdown” on, then maybe one of the three approaches above:
- don’t allow adding text to the beginning or end of a link (except by the popup pane)
- simple, don’t have to keep track of where the cursor came from, and is pretty common
- you can always add text just before the last character, then move it
- force people to always use the popup pane and don’t allow moving the cursor into the link with the arrow keys
- doesn’t seem like it would work for Legend, because people still may want to type in the link syntax
- change the behaviour depending on how the cursor arrived at the beginning or end
- maybe a more simplified version of what Thunderbird does?
- if you click inside the link text, you can move the cursor to the beginning or end with the arrow keys, and it will still edit the link text
- otherwise, if you click outside, or right at the beginning or end, or just finished adding the link, it won’t
- probably more work to code, don’t know if it’s worthwhile
- some other method?