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

Automatic closing of single-quotes #708

Closed
sanderboom opened this Issue Sep 5, 2017 · 21 comments

Comments

Projects
None yet
3 participants
@sanderboom
Contributor

sanderboom commented Sep 5, 2017

Expected behaviour

Press ' and see '', with the cursor in the middle.

Actual behaviour

Press ' and nothing happens.

Steps to reproduce

Press '

Output from the debug section in the settings dialog

See: #709

Relevant log output (you have to enable enable the log widget)

None

@sanderboom

This comment has been minimized.

Contributor

sanderboom commented Sep 5, 2017

BTW this works for double-quotes:

Pressing " -> "" with the cursor in the middle.


BTW, this setting is enabled:
image

I would expect that pressing one backtick would auto-close this with an second backtick. The same goes for 3 backticks.

Thanks for looking into this!

@pbek

This comment has been minimized.

Owner

pbek commented Sep 5, 2017

Thank you for your suggestion.

@pbek pbek added the enhancement label Sep 5, 2017

@pbek

This comment has been minimized.

Owner

pbek commented Sep 5, 2017

' is doable, but the backticks aren't (at least without a tremendous ammout of work) because they have no keyevent and keycode.

@sanderboom

This comment has been minimized.

Contributor

sanderboom commented Sep 5, 2017

' Would be great already!

backticks aren't (at least without a tremendous ammout of work) because they have no keyevent and keycode.

Don't spend too much time on this, it's not that important ;)
Still quite bizarre that backticks are weird like that!

@pbek

This comment has been minimized.

Owner

pbek commented Sep 5, 2017

17.09.1

  • the automatic closing of brackets now also works for '

@pbek pbek added this to the 17.09.1 milestone Sep 5, 2017

@pbek

This comment has been minimized.

Owner

pbek commented Sep 6, 2017

There now is a new release, could you please test it and report if it works for you?

There is quite some other interesting stuff in this release, in case you want to test it...

17.09.1

  • the QMarkdownTextedit, which is used in all markdown text-edits is now based
    onQPlainTextEdit instead of QTextEdit, which should result in improved
    rendering speed
    for large notes
    • this will improve the note text edit, log panel, version dialog, trash
      dialog, todo dialog, settings dialog, note dialog and note history dialog
  • you can now choose different interface styles in the Interface settings
    to change the look of the application's interface and its controls
    • the style will be previewed instantly if you select an other style
    • if you select Automatic you will be prompted to restart the application
  • the snap-packaged version of QOwnNotes will now automatically use the Fusion
    interface style, which dramatically improves the styling of the user interface

sanderboom added a commit to sanderboom/qmarkdowntextedit that referenced this issue Sep 7, 2017

sanderboom added a commit to sanderboom/qmarkdowntextedit that referenced this issue Sep 7, 2017

sanderboom added a commit to sanderboom/qmarkdowntextedit that referenced this issue Sep 7, 2017

sanderboom added a commit to sanderboom/qmarkdowntextedit that referenced this issue Sep 7, 2017

@sanderboom

This comment has been minimized.

Contributor

sanderboom commented Sep 7, 2017

Works great, thanks!

Like always, an answer leads to more questions... ;)

I've tried to add some more characters (_ and ~). Maybe the patch is not completely correct, but at least a starting point.

sanderboom added a commit to sanderboom/qmarkdowntextedit that referenced this issue Sep 7, 2017

sanderboom added a commit to sanderboom/qmarkdowntextedit that referenced this issue Sep 7, 2017

@pbek

This comment has been minimized.

Owner

pbek commented Sep 7, 2017

Great, thank you for testing and thank you for your addition!

There now is a new release, could you please test it and report if it works for you?

17.09.2

@sanderboom

This comment has been minimized.

Contributor

sanderboom commented Sep 8, 2017

Seems like it works!

Actually the case for ~ should be similar to how * now is:

  • insert ~: nothing happens
  • insert the second ~: autocomplete as: ~~cursor~~
@sanderboom

This comment has been minimized.

Contributor

sanderboom commented Sep 8, 2017

I've tried something and will send a PR

@pbek

This comment has been minimized.

Owner

pbek commented Sep 8, 2017

Great, thank you for testing! And good luck, have fun. ;)

@florianklumb

This comment has been minimized.

florianklumb commented Sep 11, 2017

I'm not quite sure this feature makes sense to me. Correct me if I'm wrong but at this point I cannot write normal English sentences without having to delete the second ' all the time. I understand that this makes sense for writing Markdown in special cases. But we have to think about what use case is more frequent. IMHO the use case of writing a single ' as in "I'm / don't / G'day" is, for the average user, much more frequent than wanting '' (I actually don't know what this stands for) and that should be made as simple as possible. This seems to be a special need and maybe could also be solved by scripting.

@sanderboom

This comment has been minimized.

Contributor

sanderboom commented Sep 11, 2017

Your point makes sense. Not being a native English speaker/writer, this did not come to my mind. Also, I approached this more from a programming editor's view, typing ' in this context nearly always needs a second '.

Suggestion:

  • make autocompletion of ' a setting
  • only enable autocompletion of ' in codeblocks

What are your thoughts @pbek?

@pbek

This comment has been minimized.

Owner

pbek commented Sep 11, 2017

Ah, now I remember why I didn't do ' back then! :D
@sanderboom, I think we have to remove that...

@pbek

This comment has been minimized.

Owner

pbek commented Sep 11, 2017

only enable autocompletion of ' in codeblocks

you can go for that, sounds like a good compromise

@sanderboom

This comment has been minimized.

Contributor

sanderboom commented Sep 11, 2017

you can go for that, sounds like a good compromise

Ok!

@yodayeti what are your thoughts on this?

@florianklumb

This comment has been minimized.

florianklumb commented Sep 11, 2017

Sounds good to me!

@pbek

This comment has been minimized.

Owner

pbek commented Sep 12, 2017

17.09.4

  • apostrophe bracket closing is temporary disabled because apostrophes are used
    in different contexts
@pbek

This comment has been minimized.

Owner

pbek commented Sep 12, 2017

There now is a new release, could you please test it and report if it works for you?

@florianklumb

This comment has been minimized.

florianklumb commented Sep 12, 2017

Work as expected: pressing ' does not create a duplicate anymore.

@pbek

This comment has been minimized.

Owner

pbek commented Sep 13, 2017

Great, thank you for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment