notepadqq / notepadqq

A simple, general-purpose editor for Linux
https://notepadqq.com
GNU General Public License v3.0
2.09k stars 298 forks source link

Unwanted math and formatting in VBScript comments #920

Open severach opened 4 years ago

severach commented 4 years ago

Describe the bug VBScript comments are interpreting $ codes and causing unusual formatting including Math, Fonts, and Subscript. I can't edit comments with all the strange messages in the way.

To Reproduce Set Language to VBScript. Put in this code.

REM Language VBScript
REM Missing open brace for superscript $^&$
REM Misplaced & $&$
REM Double exponent: use braces to clarify $5018^2^^1$
REM The B's are enlarged text  AAAAAAA$BBB$CCCC
REM The B's are enlarged and italic  AAAAAAA$"BBB"$CCCC
REM The B's are enlarged and italic  AAAAAAA$,BBB$CCCC
REM The spaces have disappeared AAAAAAA$ B B B $CCCC
REM The D's are invisible AAAAAAA$BBB%DDDD$CCCC
REM The M is in subscript $AAAA_MAAAAA$

Expected behavior All comments should have the same font and no strange messages.

Screenshots Screenshot_2019-11-06_13-49-33

Environment (please complete the following information):

% pacman -Q notepadqq-git uchardet qt5-webengine qt5-base
notepadqq-git 2.0.0.beta.r5.g5553c0be-1
uchardet 0.0.6-2
qt5-webengine 5.13.2-2
qt5-base 5.13.2-1

Additional context $ are all over the code but the unwanted reformatting only happens in comments. I have downgraded to previous Notepadqq versions and the behaviour doesn't change. The source seems to be in some other qt5 component.

danieleds commented 4 years ago

Chris,

Notepadqq is trying to interpret what's between the dollar signs as math notation. You can obtain the expected behavior by deactivating Math Rendering from the "View" menu. Let me know if it works.

I will edit the title and leave this issue open because we should add some basic logic to detect whether what's inside the dollar signs is actually math

severach commented 4 years ago

That works. Why does Math Rendering default on? Why does it only happen in comments?

danieleds commented 4 years ago

You can take a look here for a brief intro to Math Rendering and its motivations: https://notepadqq.com/wp/2018/04/introducing-math-rendering-in-notepadqq-1-4/

It was enabled by default only in the latest prerelease version of Nqq.