Closing parenthesis equal rights

51 views
Skip to first unread message

Daniel Volinski

unread,
Mar 18, 2018, 4:23:51 AM3/18/18
to Project Jupyter
Hi All,

I'm using SageMath 8.1 on Windows 10 Native with Jupyter Notebook.

When I select text on a code cell and punch on any key on the keyboard, the selected text is erased and that key is issued instead. Except for the opening parenthesis, in its case, the selected text is enclosed by an opening parenthesis at its left and a closing parenthesis at its right. That is awesome. It saves me from going to other side of the text and add the closing parenthesis by myself.

Why not doing the same for the closing parenthesis? Right now, punching the closing parenthesis erases the selected text like any other key. I would like the closing parenthesis to be treated with the same respect as the opening parenthesis, that is, when I select text, (usually from left to right) my cursor is already at the right of the selected text. I want to punch the closing parenthesis and I want SageMath to add the opening parenthesis at the beginning of the selected text, saving me time once again.

This should be equally valid for rectangular and curly parenthesis.

Daniel


Thomas Kluyver

unread,
Mar 19, 2018, 7:09:35 AM3/19/18
to Project Jupyter
The JS text editor component we use is called CodeMirror. If CodeMirror already has an option to do what you want, we can probably find a way to enable it. Otherwise, you'd need to convince CodeMirror to add the feature first.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/ef3e9051-36a6-4829-999c-eabd127d36ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Volinski

unread,
Sep 6, 2020, 5:17:09 AM9/6/20
to Project Jupyter
Does that feature exist in CodeMirror?

Daniel


On Monday, March 19, 2018 at 1:09:35 PM UTC+2 takowl wrote:
The JS text editor component we use is called CodeMirror. If CodeMirror already has an option to do what you want, we can probably find a way to enable it. Otherwise, you'd need to convince CodeMirror to add the feature first.

On 18 March 2018 at 08:23, 'Daniel Volinski' via Project Jupyter <jup...@googlegroups.com> wrote:
Hi All,

I'm using SageMath 8.1 on Windows 10 Native with Jupyter Notebook.

When I select text on a code cell and punch on any key on the keyboard, the selected text is erased and that key is issued instead. Except for the opening parenthesis, in its case, the selected text is enclosed by an opening parenthesis at its left and a closing parenthesis at its right. That is awesome. It saves me from going to other side of the text and add the closing parenthesis by myself.

Why not doing the same for the closing parenthesis? Right now, punching the closing parenthesis erases the selected text like any other key. I would like the closing parenthesis to be treated with the same respect as the opening parenthesis, that is, when I select text, (usually from left to right) my cursor is already at the right of the selected text. I want to punch the closing parenthesis and I want SageMath to add the opening parenthesis at the beginning of the selected text, saving me time once again.

This should be equally valid for rectangular and curly parenthesis.

Daniel


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

William Stein

unread,
Sep 6, 2020, 2:22:51 PM9/6/20
to Project Jupyter
Quick comment: you can still type open parenthesis at the *end* of the selection, and Codemirror will correctly put parenthesis around the selection.   I.e., almost exactly what you want already exists as long as you type "(" right where you were thinking of typing ")".

William Stein

unread,
Sep 6, 2020, 2:36:20 PM9/6/20
to Project Jupyter
Also, the current behavior of CodeMirror regarding "select and hit any of (,[,{, ),],}" is the same as what VSCode does, which uses a completely different editor than CodeMirror (Monaco).  It's nice to maintain compatibility with other editors.
Reply all
Reply to author
Forward
0 new messages