GNOME Bugzilla – Bug 730713
"Draw spaces" plugin consider first spaces of a paragraph as "inside text"
Last modified: 2014-05-29 14:40:37 UTC
In "Draw spaces" plugin preferences, if you uncheck "show spaces in text" then the spaces BEFORE the FIRST line of a paragraph are not drawn. Checking 'show spaces before' has no effect on the first line of a paragraph, but has effect on other lines.
Sorry, I use French locale, here are exact captions : 'show spaces before' meant "Draw leading spaces" "show spaces in text" meant Draw spaces in text
Can you attach a sample file? Because I can't reproduce the problem.
Created attachment 277199 [details] Test file A test file, and screenshots showing settings and effects
Ok now I can reproduce the bug, thanks. (instead of a .zip, a .tar.gz or .tar.xz is better on Linux, or attach the files separately on bugzilla, so they can be viewed directly in the web browser) (the screenshots are in French, for other developers than me it's better to run gedit like this: $ LANG=C gedit so gedit is in English)
Created attachment 277214 [details] Test file, and screenshots showing settings and effect English locale and tar file
This is a regression of this commit: https://git.gnome.org/browse/gtksourceview/commit/?id=2f937fa56861f48d85edcfe581e85dafe8ede9c5 See bug #710973. Correctness is more important than performance. And it is anyway planned in the future to draw spaces directly by pango, so the performance problem will disappear and the implementation will be cleaner. I've read the code, and it's quite complicated without a lot of comments, so it's difficult to understand. And there are maybe other bugs. So I think it's better to revert the commit.
See bug #721015 for the cleaner implementation with a new API in GtkTextView and pango.
Created attachment 277459 [details] [review] fix gtk_text_iter_forward_to_line_end says: If the iterator is already at the paragraph delimiter characters, moves to the paragraph delimiter characters for the next line. Because of this, get_end_iter treated the whole line following a blank line as "inside text". Similarly, get_leading_trailing also treated the whole line following a blank as "trailing".
Thanks for the bug fix. I've pushed the commit: https://git.gnome.org/browse/gtksourceview/commit/?id=85303a6b406916603d2d2289aba7bff1fd2ac193 (I've fixed the coding style for curly braces around blocks, and added a title to the commit message)