After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730713 - "Draw spaces" plugin consider first spaces of a paragraph as "inside text"
"Draw spaces" plugin consider first spaces of a paragraph as "inside text"
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
3.12.x
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-25 12:57 UTC by Raphael Rochet
Modified: 2014-05-29 14:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test file (218.32 KB, application/x-zip)
2014-05-26 14:31 UTC, Raphael Rochet
  Details
Test file, and screenshots showing settings and effect (121.21 KB, application/gzip)
2014-05-26 15:46 UTC, Raphael Rochet
  Details
fix (1.53 KB, patch)
2014-05-29 14:18 UTC, Arpad Borsos
none Details | Review

Description Raphael Rochet 2014-05-25 12:57:47 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.
Comment 1 Raphael Rochet 2014-05-25 13:04:40 UTC
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
Comment 2 Sébastien Wilmet 2014-05-26 14:23:00 UTC
Can you attach a sample file? Because I can't reproduce the problem.
Comment 3 Raphael Rochet 2014-05-26 14:31:47 UTC
Created attachment 277199 [details]
Test file

A test file, and screenshots showing settings and effects
Comment 4 Sébastien Wilmet 2014-05-26 15:27:59 UTC
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)
Comment 5 Raphael Rochet 2014-05-26 15:46:50 UTC
Created attachment 277214 [details]
Test file, and screenshots showing settings and effect

English locale and tar file
Comment 6 Sébastien Wilmet 2014-05-26 16:36:44 UTC
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.
Comment 7 Sébastien Wilmet 2014-05-26 17:30:19 UTC
See bug #721015 for the cleaner implementation with a new API in GtkTextView and pango.
Comment 8 Arpad Borsos 2014-05-29 14:18:54 UTC
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".
Comment 9 Sébastien Wilmet 2014-05-29 14:40:37 UTC
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)