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 742934 - Builder sometimes does not honor indentation preferences
Builder sometimes does not honor indentation preferences
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: editor
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-01-14 19:28 UTC by Michael Catanzaro
Modified: 2015-01-20 14:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screencast demonstrating broken indentation setting (899.13 KB, application/octet-stream)
2015-01-14 19:28 UTC, Michael Catanzaro
  Details
sourceview: make indent-width match tab-width (2.58 KB, patch)
2015-01-20 05:24 UTC, Christian Hergert
committed Details | Review

Description Michael Catanzaro 2015-01-14 19:28:00 UTC
Created attachment 294551 [details]
screencast demonstrating broken indentation setting

I have my indentation settings for a CMake file set to four spaces, no tabs. But when I press the tab key, Builder indents eight spaces (no tabs).
Comment 1 Christian Hergert 2015-01-14 20:50:16 UTC
I think this is because we are only setting tab_width, and not indent width. We don't currently expose them as individual options either.

We can either:

 1) g_settings_bind() both to tab_width from gsettings
 2) expose them as individual options

I think we may have to go with 2, because some projects like nautilus use 2 space indents with hard tabs at 8.
Comment 2 Michael Catanzaro 2015-01-17 01:21:08 UTC
Does comment #1 explain why it's impossible to convince builder to add any hard tabs to e.g. epiphany/src/ephy-prefs.c? That file consistently uses eight-space tabs for indentation. Builder autodetects two spaces, no tabs. When I change the setting to eight space tabs, Builder still inserts two spaces when I press the tab key.
Comment 3 Igor Gnatenko 2015-01-18 14:50:14 UTC
(In reply to comment #1)
> I think this is because we are only setting tab_width, and not indent width. We
> don't currently expose them as individual options either.
> 
> We can either:
> 
>  1) g_settings_bind() both to tab_width from gsettings
>  2) expose them as individual options
> 
> I think we may have to go with 2, because some projects like nautilus use 2
> space indents with hard tabs at 8.

I'd like to have vim/emacs/etc. tabs-settings parser.
Comment 4 Michael Catanzaro 2015-01-18 15:03:22 UTC
A good place to start: https://git.gnome.org/browse/gedit/tree/plugins/modelines/modeline-parser.c
Comment 5 Igor Gnatenko 2015-01-18 16:24:06 UTC
(In reply to comment #4)
> A good place to start:
> https://git.gnome.org/browse/gedit/tree/plugins/modelines/modeline-parser.c

great! I think more better to do this on gnome-code-assistance layer, but not sure.
Comment 6 Christian Hergert 2015-01-18 22:28:08 UTC
It needs to be done where the auto indenters live, which is inside the editor process (ie: Builder itself).
Comment 7 Christian Hergert 2015-01-20 05:24:23 UTC
Created attachment 294944 [details] [review]
sourceview: make indent-width match tab-width

We still need to expose this in language settings.
Comment 8 Christian Hergert 2015-01-20 05:25:41 UTC
The bug in question here should be fixed in master. I'd still like to expose indent-width separate from tab-width at some point.

Attachment 294944 [details] pushed as 9bd5a04 - sourceview: make indent-width match tab-width
Comment 9 Michael Catanzaro 2015-01-20 14:50:11 UTC
(In reply to comment #1)
> I think we may have to go with 2, because some projects like nautilus use 2
> space indents with hard tabs at 8.

In these projects, pressing the tab key needs to always insert a tab character. I'm not sure what the value would be in having a separate setting for indentation size?