Bug 43090 - Auto Closing / Highlighting of brackets
Summary: Auto Closing / Highlighting of brackets
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
3.5.0 RC1
Hardware: Other All
: low enhancement
Assignee: Marcos Souza
URL:
Whiteboard: target:4.2.0 target:5.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-19 05:27 UTC by Florian Reisinger
Modified: 2017-12-29 17:52 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
The basic description. (11.10 KB, application/vnd.oasis.opendocument.text)
2011-11-19 05:27 UTC, Florian Reisinger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Reisinger 2011-11-19 05:27:12 UTC
Created attachment 53687 [details]
The basic description.

In addition to Bug 43089: https://bugs.freedesktop.org/show_bug.cgi?id=43089 
auto closing for brackets would be a nice feature. Please refer to the attached .odt file.
Comment 1 Florian Reisinger 2012-01-21 11:12:47 UTC
I can confirm this ;P
if you don't want it, you still can give it the status: "Notabug"
Comment 2 Commit Notification 2013-06-26 12:22:05 UTC
Marcos Paulo de Souza committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d12980ce0b86549028ddaac3192f14456dde25c6

Fix fdo#43090: Auto Closing of brackets



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 3 Marcos Souza 2013-06-26 12:44:47 UTC
Florian, a change that I did went to master. Can you please test if this works as spected?

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d12980ce0b86549028ddaac3192f14456dde25c6

Thanks since now!
Comment 4 Florian Reisinger 2013-06-26 13:07:54 UTC
Putting status accordingly....
Just, because I am interested: Math, Calc, available in OLE, Basic IDE? I will test, if a master is available with this included.

Big +1 to you Marcos!!!
PS: What do you think about highlighting the corresponding brackets, when mouse is before or after the letter...
Comment 5 Marcos Souza 2013-06-26 13:10:46 UTC
I'll love to do this!

I will study how this can be implemented :)

Thanks for testing this!
Comment 6 Florian Reisinger 2013-06-26 13:16:24 UTC
Would you please tell me where this should work:
-Calc
-Math
-Basic IDE
-OLE
.
.
.

Testing is, what QA does ;)
Comment 7 Marcos Souza 2013-06-26 13:21:46 UTC
I tested this in Math, but I believe it will work too in Writer too when inserting a formula.
Comment 8 Florian Reisinger 2013-06-26 14:11:47 UTC
Would as well be great to have this in Calc and Macro IDE...
Comment 9 Marcos Souza 2013-06-26 14:15:52 UTC
Florian, this worked as you desired? I'm asking this because was you who opened this bug :)
Comment 10 Florian Reisinger 2013-06-26 14:18:11 UTC
There is no master available yet (on Win)
Comment 11 Marcos Souza 2013-06-26 14:20:39 UTC
Ow, sorry!

I was thinking that you were pulling the current master!

Sorry!
Comment 12 Marcos Souza 2013-06-26 14:49:09 UTC
Florian, there is already another bug about syntax highlight: bug https://bugs.freedesktop.org/show_bug.cgi?id=43089 

Do you think we need to put this enhancement here too?
Comment 13 Florian Reisinger 2013-06-26 16:51:30 UTC
Nope, sorry....
Different request...
Comment 14 Marcos Souza 2013-06-26 16:55:43 UTC
So, your test was sucessfull? I'm asking because of the Resolved status :)
Comment 15 Florian Reisinger 2013-06-26 17:24:33 UTC
Still no test build available. If succeed -> VERIFIED FIXED
Comment 16 Florian Reisinger 2013-06-27 12:03:56 UTC
Hi,

Tested now. I hope that this does not sound rude, but the program behaves "silly", if the user wants to edit existing formulas ;)

Example: 14} --> Oh damn, I forget the opening --> 14 {  }} or

I opened one example and want to try to get f(x) red:
Steps follow:
1) f ( x ) = {1} over {%sigma sqrt{2%pi} }e^-{{(x-%mu)^2} over {2%sigma^2}} //original 
2) color red f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2} over {2%sigma^2}} // I want f(x) red, not f only!! 
3) color red {  }f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2} over {2%sigma^2}} // Damn
4) color red {  f ( x )} = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2} over {2%sigma^2}} // Deleting manually the auto-created brackets and adding a new one....

In short:
Please only at the END of current formula or when "<?>" is selected.
I hope that did not sound rude or anything like that....
== Feedback provided ==
Anywhere documented??

PS: I like the new sidebar, but the Elements dialog should stay closed as standard...
Comment 17 Marcos Souza 2013-06-27 16:02:08 UTC
Hi Florian,

(In reply to comment #16)
> Hi,
> 
> Tested now. I hope that this does not sound rude, but the program behaves
> "silly", if the user wants to edit existing formulas ;)

Ow, relax! You're being rude :)

> 
> Example: 14} --> Oh damn, I forget the opening --> 14 {  }} or

Here we can put a rule: Only close the {, ( or [ when we don't have a }, ] or ) as next character. (we can check all characters after the current position, and verify if we don't have a correspondent closing symbol)

> 
> I opened one example and want to try to get f(x) red:
> Steps follow:
> 1) f ( x ) = {1} over {%sigma sqrt{2%pi} }e^-{{(x-%mu)^2} over {2%sigma^2}}
> //original 
> 2) color red f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2} over
> {2%sigma^2}} // I want f(x) red, not f only!! 

> 3) color red {  }f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> over {2%sigma^2}} // Damn
> 4) color red {  f ( x )} = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> over {2%sigma^2}} // Deleting manually the auto-created brackets and adding
> a new one....
> 
> In short:
> Please only at the END of current formula or when "<?>" is selected.
> I hope that did not sound rude or anything like that....

So, when opening a {, do you think we can put } at the end of the whole formula, or in the end of the placeholder when is selected? This be easily done :)

So, what you think about my first idea? Or we can exchange my idea yours (put the '}' in the end of formula) ?

> == Feedback provided ==
> Anywhere documented??

Not yet! When it's working, we can put this in the 4.2 release notes!

> 
> PS: I like the new sidebar, but the Elements dialog should stay closed as
> standard...
Was not me that implemented the sidebar :) But maybe we can work on this after we solve this auto close issue =D
Comment 18 Florian Reisinger 2013-06-27 16:35:44 UTC
Hi Marcos,

(In reply to comment #17)
> Hi Florian,
> 
> (In reply to comment #16)
> > Hi,
> > 
> > Tested now. I hope that this does not sound rude, but the program behaves
> > "silly", if the user wants to edit existing formulas ;)
> 
> Ow, relax! You're being rude :)

Sorry for that...
> 
> > 
> > Example: 14} --> Oh damn, I forget the opening --> 14 {  }} or
> 
> Here we can put a rule: Only close the {, ( or [ when we don't have a }, ]
> or ) as next character. (we can check all characters after the current
> position, and verify if we don't have a correspondent closing symbol)

Mmh, I won't go for that (IMHO could be a little bit slow, especially long formulas....)
> 
> > 
> > I opened one example and want to try to get f(x) red:
> > Steps follow:
> > 1) f ( x ) = {1} over {%sigma sqrt{2%pi} }e^-{{(x-%mu)^2} over {2%sigma^2}}
> > //original 
> > 2) color red f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2} over
> > {2%sigma^2}} // I want f(x) red, not f only!! 
> 
> > 3) color red {  }f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> > over {2%sigma^2}} // Damn
> > 4) color red {  f ( x )} = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> > over {2%sigma^2}} // Deleting manually the auto-created brackets and adding
> > a new one....
> > 
> > In short:
> > Please only at the END of current formula or when "<?>" is selected.
> > I hope that did not sound rude or anything like that....
> 
> So, when opening a {, do you think we can put } at the end of the whole
> formula, or in the end of the placeholder when is selected? This be easily
> done :)

If we are at the end (formulaText.Length -1 == currentPosition) we are totally sage placing a bracket ;)

If we are in the middle of a text (I know this might sound silly), we should turn it off, except of, when <?> is selected and a bracket is pressed... It should stay on as long as we do not manually change the position... Easily possible??

> 
> So, what you think about my first idea? Or we can exchange my idea yours
> (put the '}' in the end of formula) ?

I would really advise you to use my idea. This seems not annoying.... (Think of the 4 steps example, your idea still woun't work - Okay, this might be rude as well. Do not take it that way!!)

> 
> > == Feedback provided ==
> > Anywhere documented??
> 
> Not yet! When it's working, we can put this in the 4.2 release notes!

+1

> 
> > 
> > PS: I like the new sidebar, but the Elements dialog should stay closed as
> > standard...
> Was not me that implemented the sidebar :)
I know
> But maybe we can work on this
> after we solve this auto close issue =D

Should not be too difficult. Just turn off the old dialog showing up as default ;)
Comment 19 Marcos Souza 2013-06-27 17:04:27 UTC
(In reply to comment #18)
> Hi Marcos,
> 
> (In reply to comment #17)
> > Hi Florian,
> > 
> > (In reply to comment #16)
> > > Hi,
> > > 
> > > Tested now. I hope that this does not sound rude, but the program behaves
> > > "silly", if the user wants to edit existing formulas ;)
> > 
> > Ow, relax! You're being rude :)
> 
> Sorry for that...

Ow man! Sorry²!! I was trying to write "not rude" but I forget the not =P
You're not rude man =D

> > 
> > > 
> > > Example: 14} --> Oh damn, I forget the opening --> 14 {  }} or
> > 
> > Here we can put a rule: Only close the {, ( or [ when we don't have a }, ]
> > or ) as next character. (we can check all characters after the current
> > position, and verify if we don't have a correspondent closing symbol)
> 
> Mmh, I won't go for that (IMHO could be a little bit slow, especially long
> formulas....)

ok

> > 
> > > 
> > > I opened one example and want to try to get f(x) red:
> > > Steps follow:
> > > 1) f ( x ) = {1} over {%sigma sqrt{2%pi} }e^-{{(x-%mu)^2} over {2%sigma^2}}
> > > //original 
> > > 2) color red f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2} over
> > > {2%sigma^2}} // I want f(x) red, not f only!! 
> > 
> > > 3) color red {  }f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> > > over {2%sigma^2}} // Damn
> > > 4) color red {  f ( x )} = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> > > over {2%sigma^2}} // Deleting manually the auto-created brackets and adding
> > > a new one....
> > > 
> > > In short:
> > > Please only at the END of current formula or when "<?>" is selected.
> > > I hope that did not sound rude or anything like that....
> > 
> > So, when opening a {, do you think we can put } at the end of the whole
> > formula, or in the end of the placeholder when is selected? This be easily
> > done :)
> 
> If we are at the end (formulaText.Length -1 == currentPosition) we are
> totally sage placing a bracket ;)

agree

> 
> If we are in the middle of a text (I know this might sound silly), we should
> turn it off, except of, when <?> is selected and a bracket is pressed... It
> should stay on as long as we do not manually change the position... Easily
> possible??

Right :)

So, if we're in the end of the text we can auto close the brace. It the middle of text, and "<?>" selected and brace was pressed, put "{}" or "{<?>}"?

And another doubt: Do you think it's more "elegant" to have "{  }" or maybe "{}" when auto closing?

> 
> > 
> > So, what you think about my first idea? Or we can exchange my idea yours
> > (put the '}' in the end of formula) ?
> 
> I would really advise you to use my idea. This seems not annoying.... (Think
> of the 4 steps example, your idea still woun't work - Okay, this might be
> rude as well. Do not take it that way!!)

Agreed! Sorry for before, was my mistake to wrote rude instead of "not rude"!


> 
> > 
> > > == Feedback provided ==
> > > Anywhere documented??
> > 
> > Not yet! When it's working, we can put this in the 4.2 release notes!
> 
> +1
> 
> > 
> > > 
> > > PS: I like the new sidebar, but the Elements dialog should stay closed as
> > > standard...
> > Was not me that implemented the sidebar :)
> I know
> > But maybe we can work on this
> > after we solve this auto close issue =D
> 
> Should not be too difficult. Just turn off the old dialog showing up as
> default ;)
Hum, very nice! I will at this! Maybe we can enable the new dialog by default?
Comment 20 Florian Reisinger 2013-06-27 17:16:17 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > Hi Marcos,
> > 
> > (In reply to comment #17)
> > > Hi Florian,
> > > 
> > > (In reply to comment #16)
> > > > Hi,
> > > > 
> > > > Tested now. I hope that this does not sound rude, but the program behaves
> > > > "silly", if the user wants to edit existing formulas ;)
> > > 
> > > Ow, relax! You're being rude :)
> > 
> > Sorry for that...
> 
> Ow man! Sorry²!! I was trying to write "not rude" but I forget the not =P
> You're not rude man =D

LOL

> 
> > > 
> > > > 
> > > > Example: 14} --> Oh damn, I forget the opening --> 14 {  }} or
> > > 
> > > Here we can put a rule: Only close the {, ( or [ when we don't have a }, ]
> > > or ) as next character. (we can check all characters after the current
> > > position, and verify if we don't have a correspondent closing symbol)
> > 
> > Mmh, I won't go for that (IMHO could be a little bit slow, especially long
> > formulas....)
> 
> ok
> 
> > > 
> > > > 
> > > > I opened one example and want to try to get f(x) red:
> > > > Steps follow:
> > > > 1) f ( x ) = {1} over {%sigma sqrt{2%pi} }e^-{{(x-%mu)^2} over {2%sigma^2}}
> > > > //original 
> > > > 2) color red f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2} over
> > > > {2%sigma^2}} // I want f(x) red, not f only!! 
> > > 
> > > > 3) color red {  }f ( x ) = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> > > > over {2%sigma^2}} // Damn
> > > > 4) color red {  f ( x )} = {1} over  {%sigma sqrt{2%pi} } e^-{{(x-%mu)^2}
> > > > over {2%sigma^2}} // Deleting manually the auto-created brackets and adding
> > > > a new one....
> > > > 
> > > > In short:
> > > > Please only at the END of current formula or when "<?>" is selected.
> > > > I hope that did not sound rude or anything like that....
> > > 
> > > So, when opening a {, do you think we can put } at the end of the whole
> > > formula, or in the end of the placeholder when is selected? This be easily
> > > done :)
> > 
> > If we are at the end (formulaText.Length -1 == currentPosition) we are
> > totally sage placing a bracket ;)
> 
> agree
> 
> > 
> > If we are in the middle of a text (I know this might sound silly), we should
> > turn it off, except of, when <?> is selected and a bracket is pressed... It
> > should stay on as long as we do not manually change the position... Easily
> > possible??
> 
> Right :)
> 
> So, if we're in the end of the text we can auto close the brace. It the
> middle of text, and "<?>" selected and brace was pressed, put "{}" or
> "{<?>}"?

{}. In this case I would go for {  }. (Like it is now ;) )
> 
> And another doubt: Do you think it's more "elegant" to have "{  }" or maybe
> "{}" when auto closing?

Dedinitely first one. Another idea: Auto formatting code :p

> 
> > 
> > > 
> > > So, what you think about my first idea? Or we can exchange my idea yours
> > > (put the '}' in the end of formula) ?
> > 
> > I would really advise you to use my idea. This seems not annoying.... (Think
> > of the 4 steps example, your idea still woun't work - Okay, this might be
> > rude as well. Do not take it that way!!)
> 
> Agreed! Sorry for before, was my mistake to wrote rude instead of "not rude"!
> 
> 
> > 
> > > 
> > > > == Feedback provided ==
> > > > Anywhere documented??
> > > 
> > > Not yet! When it's working, we can put this in the 4.2 release notes!
> > 
> > +1
> > 
> > > 
> > > > 
> > > > PS: I like the new sidebar, but the Elements dialog should stay closed as
> > > > standard...
> > > Was not me that implemented the sidebar :)
> > I know
> > > But maybe we can work on this
> > > after we solve this auto close issue =D
> > 
> > Should not be too difficult. Just turn off the old dialog showing up as
> > default ;)
> Hum, very nice! I will at this! Maybe we can enable the new dialog by
> default?
The new is on by default (in 4.2 master)
Comment 21 Frédéric Wang 2013-06-30 12:28:52 UTC
I agree with Florian Reisinger, this is not convenient to edit an existing formula and only doing that when <?> is selected or at the end of the formula is better.

> Here we can put a rule: Only close the {, ( or [ when we don't have a }, ] or ) as next character. (we can check all characters after the current position, and verify if we don't have a correspondent closing symbol)

I guess this won't work in general, for example if you have an escaped character \). Also, if you have "( <?> )" and type a '(' at the "<?>" position, you'll still see the existing closing ')'. You'll also need to be sure that each brace matches etc In general, this would need to parse the string with the exact Math grammar and that can be complicated.

BTW, I suspect you should not close the brace either if someone type an escaped "\(".
Comment 22 Frédéric Wang 2013-06-30 12:33:37 UTC
(In reply to comment #21)
> > Here we can put a rule: Only close the {, ( or [ when we don't have a }, ] or ) as next character. (we can check all characters after the current position, and verify if we don't have a correspondent closing symbol)
> 
> I guess this won't work in general, for example if you have an escaped
> character \). Also, if you have "( <?> )" and type a '(' at the "<?>"
> position, you'll still see the existing closing ')'. You'll also need to be
> sure that each brace matches etc In general, this would need to parse the
> string with the exact Math grammar and that can be complicated.

Actually, even when the syntax becomes invalid you don't want the closing brace  to be appended automatically. For example if you want to add parenthesis around

MYFORMULA

you move the cursor at the beginning and type a '('

(MYFORMULA

and you don't want this to become "( )MYFORMULA".
Comment 23 Marcos Souza 2013-07-16 13:38:45 UTC
Frédéric, nice tip...

So, we could look at this invalid state before auto closing.

Thanks for the tip!
Comment 24 Marcos Souza 2013-07-22 12:37:36 UTC
Hi guys, I sent a new improvement yesterday:


https://gerrit.libreoffice.org/#/c/5008/

Now it only auto close symbol if we're in a selection who have a placeholder "<?>".

So, this is a little nasty, but we can improve this a lot, by verifying if we're in "error" and/or verify if we're in the end of current line.

What you guys think about it?
Comment 25 Florian Reisinger 2013-07-22 12:51:12 UTC
So only on <?> and (please) in the end of the "text". Can break a lot, if it is in "line". Thanks for improving ;)
Comment 26 Marcos Souza 2013-07-22 12:56:44 UTC
Hi Florian!

Yes, I'll look at end of line when this patch is merged :)

So, after this, I'm planning to do more work in Math, like "Find/Replace" and other things...

If you guys could test this, I'll will be very happy :)
Comment 27 Marcos Souza 2013-07-24 17:56:20 UTC
Florian, my change was commited right now.

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f583a199b3a0812523ed75e1d2099325edad24f7

So, if you could get the next daily build and test this, it will help a lot =D

And I'll try to implement the Auto closing at end of line in few days!

See ya!
Comment 28 Commit Notification 2013-07-24 18:03:27 UTC
Marcos Paulo de Souza committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f583a199b3a0812523ed75e1d2099325edad24f7

fdo#43090: Improvement: Just auto close when found placeholder



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 29 Florian Reisinger 2013-07-29 07:06:40 UTC
Okay tested with Version: 4.2.0.0.alpha0+
Build ID: d798d26bc4b7572ed10d6baf5aef7382269d7da5
TinderBox: Win-x86@6-debug, Branch:master, Time: 2013-07-29_00:38:14
(always a new formula)
Typing "{" nothing happens (expected)
Selecting "+<?>" typing "{" nothing happens (good)
Selecting "<?> t<ping "{" resulting into "{  }" (Not perfect, because of two things:
1) Cursor should NOT be in the end (after the space), but inside the brackets.
2) The more I am thinking I prefer "{}" over "{  }". Not that beatiful, but one ArrowRight less needed...

Thanks for improving :)
Comment 30 Marcos Souza 2013-08-13 14:30:08 UTC
Hi Florian!

I finished a new version of the auto close feature.

Now it works this way:
* Auto close in end of current line of formula
* Auto close when we have "<?>" selected
* Auto close when we're in the beginning of current line.

We're adding a space between the brakets, like this: "[  ]" and putting the
cursor in the center of these brackets.
Comment 31 Commit Notification 2013-08-14 06:49:59 UTC
Marcos Paulo de Souza committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2ebe64ba90cf35d2744519d6b3a033375715614e

fdo#43090: Improve auto close brackets



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 32 Florian Reisinger 2013-08-18 17:53:17 UTC
It works perfect now, great!
Still, "Elements" is there (and the sidebar....
I know, a different thing, but please :)
Comment 33 Marcos Souza 2013-08-19 11:32:39 UTC
Florian,

So, you think we can enable the Elements Dock by default and disable Elements by default too?

I believe we can talk this on the list and see what the other guys could say about it :)

But, thanks a lot for testing!
Comment 34 Florian Reisinger 2013-08-19 13:29:45 UTC
Currently BOTH are enabled by default.....
BTW: Can I CC you, if I have further ideas for Math?
Comment 35 Marcos Souza 2013-08-19 13:33:16 UTC
Florian,

So I'll take a look how can I disable the Elements by default.

Of course you can send! Let's improve Math together :)
Comment 36 Florian Reisinger 2013-08-20 08:43:25 UTC
Hi, one thing to improve which came to my mind:
Always allow after keyword
so allow if "12 cdot" and "12 cdot ".
Do you agree to this?
Comment 37 Florian Reisinger 2013-08-20 08:45:44 UTC
Hi, just fopund out another thing... (Sorry for spamming)
Except of one case3 the curser is in the middle of the brackets. The case where3 it is not is this: "<?>". Could you please have a look at this as well??
Comment 38 Marcos Souza 2013-08-20 10:48:26 UTC
(In reply to comment #36)
> Hi, one thing to improve which came to my mind:
> Always allow after keyword
> so allow if "12 cdot" and "12 cdot ".
> Do you agree to this?

Maybe we can improve this too :)

This will be necessary a little of work in the Edit of Math, but I believe is not impossible!

Maybe I can work in this in a few time!
Comment 39 Marcos Souza 2013-08-20 10:49:54 UTC
(In reply to comment #37)
> Hi, just fopund out another thing... (Sorry for spamming)
> Except of one case3 the curser is in the middle of the brackets. The case
> where3 it is not is this: "<?>". Could you please have a look at this as
> well??

Hum, I don't understood the bug... can you put some steps to reproduce this issue?

Thanks since now!
Comment 40 Florian Reisinger 2013-08-20 16:16:18 UTC
Okay, steps:
The next thing should be like this:
Open Math. Type "{", cursor placed between the opening and closing brackets
Not working:
Open Math. Type "<?>". Select that and type "{". The cursor is after the closing bracket.
Comment 41 Marcos Souza 2013-08-29 22:19:53 UTC
Florian,

Can you please ask this question:
This error occurs when you select the "<?>" from left to right? I tested here and this error only occurs when I select the "<?>" fro right to left...

This is a know issue from Math: we don't have RTL support on Math. We can solve this erro about autoclosing by always "adjust" the selection to LTR :)

I'm waiting for your response! I'm excited to solve this issue!

Thanks since now!
Comment 42 Florian Reisinger 2013-08-30 08:51:18 UTC
Hi,

You are right, but why has the SELECTION.START and SELECTION.LENGTH the false values (not read code, just assuming)
If I select from left to right LENGTH++
If I select from right to left (which != RTL) START-- LENGTH++

I hope you understand what I mean. This is a serious bug in Math and has nothing to do with RTL...
Comment 43 Marcos Souza 2013-08-30 11:05:16 UTC
Florian,

This happens because the selection.START is the position inside the formula edit where the selection started.

So imagina here: "<?>", if we select this by RTL, our selection position will be 2, and our selection end position will be 0.

Se, the values are swapped...

But this is easy to solve. I'll send a patch right now. I'll just adjust the values, if the end position is greater the start position, just exchange the values.

What do you think?

Thanks a lot for testing!
Comment 44 Florian Reisinger 2013-08-31 08:43:49 UTC
Hi,

This would fix this very problem, but not generally. I do think, that a general fix would be better, but be quite difficult....
PS: Swapping is really the solution

Example:

test <?>
01234567

Selecting from LEFT to RIGHT:
Start: 7
End: 5
RIGHT to LEFT:
Start: 5
End:7

PS: is there a event like "onSelectionChanged"
I think this would be a better place for swapping (checking Start value is lower than End value).
Maybe it's worth a try do acomplish it this way....
Comment 45 Marcos Souza 2013-08-31 12:28:28 UTC
Hi Florian,

Yes there is a method to do his:
http://opengrok.libreoffice.org/xref/core/include/editeng/editdata.hxx#195

We can just call this Adjust method when setting the current selection, after autoclosing. I believe this is a perfect soluction :)

This method just tests about the start and end selection, and swap the values. What d you think?

I'll test this today and send a patch :)
Comment 46 Thomas Arnhold 2013-09-02 20:20:36 UTC
Should be all fixed now.

Florian, for the docking windows it seems to be better to open a new bug. This one will get far to complex otherwise ;)
Comment 47 Commit Notification 2013-09-02 20:28:27 UTC
Marcos Paulo de Souza committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1dd686175f2830227c461054f6036fb0095c4352

fdo#43090: Last fix for autoclose brackets in Math



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 48 swanyriver 2014-08-22 22:26:39 UTC
How can i disable this feature,  it slows me down, and i use libre math for midterms in school, this is a big problem

I have to type long proofs with many instances of F(0) + F(1) .... on and on

I am very familiar with closing my own parentheses and now just typing a simple (x) requires me to use the mouse to advance the cursor or use arrow keys to move two spaces over.

It sounds stupid, but it truly is more of an annoyance than a feature for me and i cant find an option to disable it.

I even tried to download the git, edit out this feature and re-build,  but somehow the behavior didn't change.
Comment 49 Florian Reisinger 2014-08-23 09:06:36 UTC
@Marcos: Can you please add this?
Comment 50 Florian Reisinger 2014-08-23 09:09:43 UTC
As a workaround. Plwase any char at the end of your writing.
"f(" will be outocorrected.
typing a "{}", then going to the beginning and start writing a formula is the workaround...

I hope that helps you
Comment 51 ti7bugs 2014-09-10 02:38:20 UTC
As-is, this feature is incredibly annoying as the new character interrups the flow of text and must be jumped somehow.

Please allow disabling of this feature or add intelligently overwriting extra enclosing characters (which would allow the flow of text to continue over a new or errant closing character).
Comment 52 Marcos Souza 2014-10-18 18:18:17 UTC
(In reply to ti7bugs from comment #51)
> As-is, this feature is incredibly annoying as the new character interrups
> the flow of text and must be jumped somehow.
> 
> Please allow disabling of this feature or add intelligently overwriting
> extra enclosing characters (which would allow the flow of text to continue
> over a new or errant closing character).

I'm now working to put a disable option in Preferences/Math. This can make you more happy with Math? :)
Comment 53 josselin.stark 2015-06-11 09:32:24 UTC
Has this disable function been implemented yet in the main build ? I can't find any documentation about it nor have I found a setting that allows to disable the auto-complete in LibreOffice Math 4.4.3.2
Comment 54 koresko 2015-08-18 16:38:40 UTC
I'd also like the option to disable the auto-close feature.  The main reason is that I tend to be watching the equation forming in main LibreOffice display as I type, and the insertion of characters I didn't explicitly type trips me up.  Also, the addition of extra spaces between the automatically-inserted brackets makes my formulas look ugly in some cases, so I tend to go back and manually remove them.

Thanks!
Comment 55 mr.scislowski 2015-09-03 18:24:40 UTC
(In reply to Marcos Souza from comment #52)
> I'm now working to put a disable option in Preferences/Math. This can make
> you more happy with Math? :)

I created an account on bugzilla just to let you know I'd really appreciate it if this (option to disable) could be implemented soon.

I'm a math teacher and, until updating to a newer version of LO, had been very happy to do all my math typesetting in LO. This new feature, however, is causing me a lot of frustration. Here are some problems I have with the current implementation:
- I am used to working in LaTeX and can type accurate formulas without looking at the screen, but this feature makes input very unpredictable, so I end up having to take my eyes of my handwritten equations, to look at the screen and fix anything.
- I dislike having to move my fingers from the home row. I don't want to have to use the mouse or arrow keys while typing (to make things worse, keyboard shortcuts don't work in the equation dialog, so I can't even customize to have emacs keybindings)
- behavior is inconsistent when doing nested arguments (e.g. sin(cos(x)))
- it doesn't correctly autocomplete scalable things (e.g. left(, left[, or left{)

I don't mind if you don't change these behaviors, as long as I have the option to disable the feature.

Thanks! I appreciate all your work!
Comment 56 Regina Henschel 2015-09-08 18:19:03 UTC
(In reply to Marcos Souza from comment #52)
> I'm now working to put a disable option in Preferences/Math. This can make
> you more happy with Math? :)

Yes, I highly wish a disable option.
Comment 57 Michael Yoo 2015-09-15 03:20:09 UTC
I too would like a bracket autocomplete disable option. Thanks!
Comment 58 josselin.stark 2015-10-18 19:55:17 UTC
Any news ?
Comment 59 Marcos Souza 2015-10-31 15:51:10 UTC
(In reply to josselin.stark from comment #58)
> Any news ?

Hi guys,

I was away of the project for some months, but I started to work on this feature. I hope to have something until the end of next week.

Sorry for the huge delay.
Comment 60 Marcos Souza 2015-11-02 23:52:27 UTC
Finally: https://gerrit.libreoffice.org/#/c/19750/

Can somebody test?

Thanks!
Comment 61 Commit Notification 2015-11-10 11:56:07 UTC
Marcos Paulo de Souza committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e2bfbfcb809329b9ed0bdd2fee14f343ca3603dd

tdf#43090: Add option to disable auto close brackets

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 62 Florian Reisinger 2015-11-17 07:33:04 UTC
Hi,

Works as expected with: Version: 5.1.0.0.alpha1+ (x64)
Build-ID: 32d4c03cba399ada807b8ec113a3928aa9e3ff7b
TinderBox: Win-x86_64@62-TDF, Branch:MASTER, Time: 2015-11-16_23:41:46
Gebietsschema: de-AT (de_AT)
Comment 63 josselin.stark 2015-11-30 19:18:40 UTC
Thank you so much, I can't wait for the release of 5.1 stable ! I don't know how I must present my testing report, so I copied the one posted before me, I hope I did it correctly^^.
Works as expected with:
Version: LibreOfficeDev_5.2.0.0.alpha0 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:MASTER, Time: 2015-11-29_23.47.29
Localization: en-US
Comment 64 john 2016-07-19 13:24:05 UTC
I found the code change, but can someone please tell me how to actually use this feature?

https://cgit.freedesktop.org/libreoffice/core/commit/?id=e2bfbfcb809329b9ed0bdd2fee14f343ca3603dd
Comment 65 Marcos Souza 2016-07-23 18:26:13 UTC
(In reply to john from comment #64)
> I found the code change, but can someone please tell me how to actually use
> this feature?
> 
> https://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=e2bfbfcb809329b9ed0bdd2fee14f343ca3603dd

Hi John,

as the e says: " Add option to disable auto close brackets". By default, each time you type (, { or [, Math will automatically close the respective character with ), } and ].

If you want to disable this behavior, just to go Settings -> Math and then disable it.
Comment 66 john 2017-02-27 08:19:42 UTC
I tested this with LibreOffice 5.2.5.1.

I have to mention that there is no "Settings->Math" in my system (Ubuntu 16.04),  hence there is no easy way to locate this configuration option, at least not as described, as far as I could tell.

I also found that I had to restart LibreOffice (all windows, not just Write windows) before the change to this setting takes effect. I think in general it should not be necessary to restart the office suite for small configuration options like this to be updated, right?

Marked as 'reopened', hopefully fixing up the configuration stuff is a very minor change.
Comment 67 john 2017-02-27 08:20:57 UTC
PS -- I had to use "Tools->Options->LibreOffice->Advanced->Expert Configuration" then search for "bracket" in order to access this configuration option. Then I had to restart LibreOffice completely.
Comment 68 Florian Reisinger 2017-02-27 08:34:07 UTC
(In reply to john from comment #67)
> PS -- I had to use "Tools->Options->LibreOffice->Advanced->Expert
> Configuration" then search for "bracket" in order to access this
> configuration option. Then I had to restart LibreOffice completely.

Hi :) You just found a bug!! (But it is related to the expert configuration):
In LibreOffice you must have the module open to see the settings -> you have to have Math open to see the setting.

hanging it via this way works totally fine, so closing the bug again. If you want to you can file a new bug, that changed options in the expert configuration do not immediately turn effective, IF such a bug does not exist.

I hope you can find the setting now :)
Comment 69 Daniel Collins 2017-12-29 17:52:16 UTC
(In reply to Florian Reisinger from comment #68)
> (In reply to john from comment #67)
> > PS -- I had to use "Tools->Options->LibreOffice->Advanced->Expert
> > Configuration" then search for "bracket" in order to access this
> > configuration option. Then I had to restart LibreOffice completely.
> 
> Hi :) You just found a bug!! (But it is related to the expert configuration):
> In LibreOffice you must have the module open to see the settings -> you have
> to have Math open to see the setting.

FYI, even when my Math editor is open, there is still no Settings -> Math menu item. (Version: 5.2.6.2 (x64) on Win7.) Would appreciate if the disabling switch was easier to find!