Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format selected text to inline code overwrites selected text #581

Closed
websealevel opened this issue Apr 6, 2022 · 8 comments
Closed

Format selected text to inline code overwrites selected text #581

websealevel opened this issue Apr 6, 2022 · 8 comments

Comments

@websealevel
Copy link

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.

  • Is this an issue or a feature which is not implemented yet ?
  • Is there any way to configure our-self a shortcut to format to inline-code?

Thank you very much for this amazing editor

@websealevel websealevel changed the title Format to inline code Format selected text to inline code Apr 6, 2022
@mitya57
Copy link
Member

mitya57 commented Apr 6, 2022

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:

retext/ReText/window.py

Lines 1138 to 1148 in 8912d45

'header': (ensurenl, '# ', text),
'italic': ('*', text, c, '*'),
'bold': ('**', text, c, '**'),
'underline': ('<u>', text, c, '</u>'),
'numbering': (ensurenl, ' 1. ', text),
'bullets': (ensurenl, ' * ', text),
'image': ('![', text or self.tr('Alt text'), c, '](', self.tr('URL'), ')'),
'link': ('[', text or self.tr('Link text'), c, '](', self.tr('URL'), ')'),
'inline code': ('`', text, c, '`'),
'code block': (ensurenl, ' ', text),
'blockquote': (ensurenl, '> ', text),

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
Copy link
Author

websealevel commented Apr 7, 2022

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 : )

@websealevel websealevel changed the title Format selected text to inline code Format selected text to inline code for AZERTY keyboard Apr 7, 2022
@mitya57 mitya57 closed this as completed in 36cb918 Apr 9, 2022
@mitya57
Copy link
Member

mitya57 commented Apr 9, 2022

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
Copy link
Author

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

@websealevel websealevel changed the title Format selected text to inline code for AZERTY keyboard Format selected text to inline code overwrite select text Apr 11, 2022
@websealevel websealevel changed the title Format selected text to inline code overwrite select text Format selected text to inline code overwrite select text when not using dropdown shortcut Apr 11, 2022
@websealevel websealevel changed the title Format selected text to inline code overwrite select text when not using dropdown shortcut Format selected text to inline code overwrites selected text Apr 11, 2022
@mitya57
Copy link
Member

mitya57 commented Apr 11, 2022

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
Copy link
Author

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
Copy link

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
Copy link
Member

mitya57 commented May 15, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants