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

Added smart parentheses and double quotes #907

Merged
merged 4 commits into from Feb 8, 2022

Conversation

melvingelbard
Copy link
Contributor

@melvingelbard melvingelbard commented Feb 3, 2022

  • Added smart parentheses '(' and ')'.
  1. Typing an opening parenthesis '(' will automatically add a closing one ')' and move the caret in the middle of both: (_ is the caret position, not a character here)

Before:

_

After:

(_)
  1. Typing a closing parenthesis when the next character is already a closing parenthesis will simply move the caret forward one position:

Before:

(_)

After:

()_

And also, Before:

doSomething(true_)

After (the closing parenthesis is not repeated):

doSomething(true)_
  • Smart double quotes '"'.
  1. Typing double quotes '"' will automatically add another following one and move the caret in-between:

Before:

_

After:

"_"
  1. Typing double quotes '"' when the next character is already a double quotes will simply move the caret forward one position:

Before:

"_"

After:

""_

And also, Before:

"Hello World_"

After:

"Hello World"_

Note

This PR cannot be merged until these notes are checked manually:

  • The smart parentheses behaviour is currently triggered by either typing the left/right parenthesis keys or Shift + 9/0, which might not be applicable to all keyboards/locales.
  • The smart double quotes behaviour is currently triggered by either typing the double quotes key or Shift + 2, which might not be applicable to all keyboards/locales.

- Smart parentheses '(' and ')'
- Smart double quotes "
- Fixed KeyCode matching
- Moved 'Enable smart editing' to 'Edit'
- Implemented backspace handling (for ''/""/())
@petebankhead petebankhead merged commit 2c40de1 into qupath:main Feb 8, 2022
@petebankhead petebankhead added this to the v0.4.0 milestone Feb 9, 2022
@melvingelbard melvingelbard deleted the fancy-parentheses branch February 9, 2022 11:26
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

Successfully merging this pull request may close these issues.

None yet

2 participants