Closing parenthesis equal rights

asked 2018-03-17 05:47:42 -0500

danielvolinski gravatar image

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.


edit retag flag offensive close merge delete


This is probably the standard behavior of the Jupyter notebook and should not be specific to SageMath.

vdelecroix gravatar imagevdelecroix ( 2018-03-17 18:34:55 -0500 )edit

It is not: the opening parenthesis works that way, the closing parenthesis does not.

danielvolinski gravatar imagedanielvolinski ( 2018-03-17 18:50:01 -0500 )edit

You can try your suggestion with the jupyter notebook developers. However, I can see why they have a key combination for "enclose selection with parentheses", and I can see why they don't have a second key combination to get exactly the same effect. Given this meaning of "(" I would actually expect that ")" would mean "remove enclosing parentheses from selection", just like "TAB" and "SHIFT-TAB" have opposite effect on a selection.

nbruin gravatar imagenbruin ( 2018-03-17 22:25:56 -0500 )edit

@nbruin, actually, I miss that "remove enclosing parentheses" functionality!

slelievre gravatar imageslelievre ( 2018-03-18 14:15:42 -0500 )edit

Where should I report a bug in the Jupyter Notebook?

danielvolinski gravatar imagedanielvolinski ( 2018-03-19 05:40:35 -0500 )edit