Bug 38887 - Improvement of SmNodeToTextVisitor
Summary: Improvement of SmNodeToTextVisitor
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.7.0
Keywords: difficultyInteresting, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2011-07-01 07:50 UTC by Björn Michaelsen
Modified: 2017-02-14 08:57 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2011-07-01 07:50:56 UTC
Improvement of SmNodeToTextVisitor

Background: When editing is carried out visually the node tree that represents a formula in memory is modified directly, the SmNodeToTextVisitor generates the command text for the formula, which is used to update the command text box in the bottom of the window. Without this visitor combination of visual and old-school command editing wouldn't be possible. The current implementation of SmNodeToTextVisitor inserts a lot of unnecessary brackets in the generated command text, to ensure that the structure is correct. Removing too many of them would create problems, and there are obscure cases where some extra brackets are needed and cases where no brackets are needed at all. Any improvement of this visitor would be very welcome. Note: The best format documentation is parser.cxx and nodes documentation is in nodes.hxx, but this task is probably easier to solve through trial and error.

Some specific things:

    Reduce the amount of whitespace, find some reasonable policy for whitespace usage.
    Use ^, _, from and to instead of rsup, rsub, csub and csup, depending on context (See this post). 

Skills: Building, C++
Comment 2 Florian Reisinger 2012-05-18 09:02:50 UTC
Deteted "Easyhack" from summary
Comment 3 Not Assigned 2012-07-17 19:47:09 UTC
Ivan Timofeev committed a patch related to this issue.
It has been pushed to "master":

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

fdo#38887: SmNodeToTextVisitor: use ^ and _ instead of rsup and rsub
Comment 4 Not Assigned 2012-07-17 19:47:33 UTC
Ivan Timofeev committed a patch related to this issue.
It has been pushed to "master":

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

fdo#38887: SmNodeToTextVisitor: use from and to instead of csub and csup
Comment 5 Not Assigned 2012-07-21 08:54:15 UTC
Ivan Timofeev committed a patch related to this issue.
It has been pushed to "master":

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

fdo#38887: SmNodeToTextVisitor: use braces for nested scripts
Comment 6 Björn Michaelsen 2013-10-04 18:46:29 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 7 Robinson Tryon (qubit) 2015-12-14 06:58:52 UTC Comment hidden (obsolete)
Comment 8 Björn Michaelsen 2016-01-26 13:01:50 UTC
Is there still work to do here? If so, who is the mentor?
Comment 9 Robinson Tryon (qubit) 2016-02-18 14:52:12 UTC Comment hidden (obsolete)
Comment 10 Thomas Arnhold 2016-02-21 15:32:03 UTC
Fixed at least with Version: 5.1.0.3. Maybe since Ivan's commits. Thanks Ivan!