retext-project / retext

ReText: Simple but powerful editor for Markdown and reStructuredText
GNU General Public License v2.0
1.88k stars 196 forks source link

Format selected text to inline code overwrites selected text #581

Closed websealevel closed 2 years ago

websealevel commented 2 years ago

When selecting some text and using back-ticks to format to inline code the text is replaced by the back-tick. Whereas this functionality works as expected for link, bold or italic.

Thank you very much for this amazing editor

mitya57 commented 2 years ago

What ReText version do you use?

I tested and it works fine for me. The selected word gets enclosed into `...`. And here you can see that logic for inline code is similar with logic for other options:

https://github.com/retext-project/retext/blob/8912d45d185588ac1fda858b4428f1c20bb3c290/ReText/window.py#L1138-L1148

Regarding the keyboard shortcut, there is no way at the moment. But I can allow you to simply select text and press `. This already works for other characters, like * and [. Will it be fine?

websealevel commented 2 years ago

I use ReText 7.2.1 (utilisant PyMarkups 3.1.1), installed from Debian repo.

But I see that the last version is currently 7.2.3.

So I have installed ReText 7.2.3 using pip3 to test. Still have the same issue.

My guess is that I'm using AZERTY Keyboard (french) so in order to do the back-tick I need to press twice ALTGR+7, the second input is replacing the selected text. Or I can do ALTGR+7 SPACE BAR, which is still a two keystrokes combination (unfortunately). On QUERTY keyboards you just need to press one key if I checked that correctly. That would explain why any other surrounding options work fine, but not this one.

Yes, to select and press ` is absolutely fine for me : )

mitya57 commented 2 years ago

My guess is that I'm using AZERTY Keyboard (french) so in order to do the back-tick I need to press twice ALTGR+7, the second input is replacing the selected text.

So did you use apply formatting from “Formatting” dropdown, or you selected text and tried to press backtick key?

If the former, then I don't see how keyboard layout would affect this.

The latter is implemented in master branch now. If you could test, that would be nice. You can simply clone the repository and run ./retext.py from there. Or pass the repository URL to pip install.

websealevel commented 2 years ago

Using Formatting dropdown it works with no problems, it is when I select and try backtick key. I ve tried by cloning the repo as you suggested but still not working when selecting then backtick. Still replacing the selected text because I have to press keyboard combination twice to make a backtick

mitya57 commented 2 years ago

I tried with AZERTY myself, but I get a backtick by pressing Alt Gr+7 only once. What option do I need to enable to have to press it twice?

websealevel commented 2 years ago

Ok thank you for your patience and for your answer. I've tried to change the version of my french keyboard and with the new push on main it's working like a charm ! So happy, will save me a lot of time and efforts : )

hydrargyrum commented 2 years ago

When reading the discussion, I'm not sure: the issue is not fixed in 7.2.3 but will be fixed in the next release, is it correct?

mitya57 commented 2 years ago

Correct, it will be fixed in the next release (8.0).