editorconfig / editorconfig-geany

EditorConfig plugin for Geany
http://editorconfig.org
GNU General Public License v2.0
44 stars 12 forks source link

Does not respect indentation on new block creation #4

Closed ParisLiakos closed 8 years ago

ParisLiakos commented 8 years ago

When creating a new block of code with {} pressing <enter> after the open bracket, Geany uses the global indentation settings instead of those in .editorconfig.

xuhdev commented 8 years ago

Can you report this to Geany please? I think that Geany resets some sort of settings after pressing <Enter> after a curly brace. Maybe there is another extension to do this for curly braces?

ParisLiakos commented 8 years ago

Not exactly sure what to report to Geany. Maybe you can help me find where Geany misbehaves, then i can open a ticket to Geany core, so they fix it? I did some more research now:

The same happens when i disable all of my addons, so its something in Geany core that causes this. Then i found this https://github.com/geany/geany/blob/master/src/editor.c#L1296

Could it be that insert_indent_after_line() is going around editorconfig somehow?

ParisLiakos commented 8 years ago

I went to #geany irc channel and asked. Some very helpful people pointed me to the correct direction: The plugin should not only talk to scintilla but should also set Geany's settings. This way, geany and every other plugin would play nicely with editorconfig.

xuhdev commented 8 years ago

Thanks for your info. I'll look into the Geany API again to fix this.

i-rinat commented 8 years ago

I believe that

scintilla_send_message(sci, SCI_SETINDENT, (uptr_t)ecConf.indent_size, 0);

should be changed to

editor_set_indent_width(gd->editor, ecConf.indent_size);

That should update both fields in GeanyEditor and in Scintilla widget.

xuhdev commented 8 years ago

@i-rinat Thanks! Should now be fixed in 9dce3bb476728a8f4124aefe12e0a4ffc8567dff

ParisLiakos commented 8 years ago

Thank you both! It seems to work properly now

i-rinat commented 8 years ago

By the way, @ParisLiakos, which Geany version do you use?

I now have 1.27. And it seems, the plugin doesn't work with it. I ended up changing it to another API to make it load.

xuhdev commented 8 years ago

@i-rinat Can you give more details? It works well on 1.24.1.

ParisLiakos commented 8 years ago

i am on 1.27 too..the one in debian's repos and it works perfectly as far as i can see.

i-rinat commented 8 years ago

@xuhdev, I tried again and now it works. I wonder what I did wrong the first time.

Sorry, that was false alarm.