[Builder] Draw unwanted spaces



Hi,

GtkSourceView can draw white spaces with symbols (e.g. an arrow for a
tab, a bullet for a simple space, etc). But the API is not really
flexible. See gtk_source_view_set_draw_spaces().

Patches are available in this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=683678

to make the API more flexible: "Visibility of leading, internal and
trailing spaces for individual types of whitespaces"

I summarize here the discussion.

A possible use-case with the new API is to draw only "unwanted" spaces.
For the C language with the GNU code conventions, unwanted spaces are:
- trailing spaces (all kind of spaces)
- for leading and internal spaces: draw all kind of spaces _except_
  normal spaces. So basically draw tabs and non-breaking spaces.

Personally I don't really like drawing all kind of spaces at every
locations, because it clutters the text.

So, is this something desirable for Builder? If so, what do you think of
the proposed API?

The state is not representable as a single property, since it is a
combination of two enums: space types and space locations. If we want
properties, there would be one property for each location (like
GtkWidget's margins). The patches in bugzilla currently only add a
getter and setter, without properties. Maybe a signal can be added, so
we have at least a notification when the state changes (a callback can
e.g. save the state in GSettings by calling the getter in a loop for
each location).

Paolo thinks such flexibility is not really needed, it is after all just
for drawing damn spaces. So having another opinion would be useful.
Personally I prefer the new API, the two enums are clearer. Saving the
state in GSettings is a little bit more complicated, but writing a loop
is not rocket science… And the application can anyway have a simpler
state, like a boolean "draw unwanted spaces".

Thanks in advance for your input,

Sébastien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]