Public bug reported:
The code comment/uncomment plugin "Code Comment" is behaving
unexpectedly. In LaTeX, % signs are used to indicate a comment, but are
also used as the actual percent sign when escaped with a \ (e.g. 50\% is
half, 25\% is one-quarter, etc...)
The uncomment part of the Code Comment plugin is removing % signs, even
when they are not at the start of a line. This can break LaTeX code, as
demonstrated with the following example
Steps to reproduce:
1. Open a new document
2. Copy/paste the LaTeX code below "Test case:"
3. Enable the Code Comment plugin under Preferences>Plugins
4. Under View>Highlight Mode..., Select LaTeX (or save file with a .tex
extension)
5. Select all text in the document.
6. Press "shift-ctrl-m" or select from the menu Edit>Uncomment Code
Test case:
\documentclass{report}
\begin{document}
Here is some text you might type in LaTeX. $>99\%$ of lines in LaTeX look like
this.
e.g. 50\% is half, 25\% is one-quarter
%Like all statistics, the above line is completely fabricated.
Here is a line with an in-line comment. %This is an inline comment and should
not be removed.
%Here is a commented line with a percentage: 50\% means the same as half.
\end{document}
Expected result (% signs should only be removed from start of line):
\documentclass{report}
\begin{document}
Here is some text you might type in LaTeX. $>99\%$ of lines in LaTeX look like
this.
e.g. 50\% is half, 25\% is one-quarter
Like all statistics, the above line is completely fabricated.
Here is a line with an in-line comment. %This is an inline comment and should
not be removed.
Here is a commented line with a percentage: 50\% means the same as half.
\end{document}
Actual result (first % sign found on a line is being removed. Note missing %
sign in lines 3, 4, 6. File won't compile now due to \$ caused on line 3):
\documentclass{report}
\begin{document}
Here is some text you might type in LaTeX. $>99\$ of lines in LaTeX look like
this.
e.g. 50\ is half, 25\% is one-quarter
Like all statistics, the above line is completely fabricated.
Here is a line with an in-line comment. This is an inline comment and should
not be removed.
Here is a commented line with a percentage: 50\% means the same as half.
\end{document}
Work-around:
Do a find-replace with "^%" as the search query and "Match as regular
expression" selected. This will match % only at the start of a line.
** Affects: gedit (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gedit in Ubuntu.
https://bugs.launchpad.net/bugs/1396649
Title:
Code Comment: uncomment removing non-comment %-signs in e.g. LaTeX
document
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/1396649/+subscriptions
--
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs