GNOME Bugzilla – Bug 784633
Vim mode: o and O don't autoindent the newly inserted line
Last modified: 2017-07-07 22:54:45 UTC
o and O should "open" a new line with automatically inserted spaces / tabs, just like inputting Enter normally does. Currently no spaces or tabs are inserted.
What language are you using? The indentation is provided by the indenter and it might be that we don't have one for your language. If that is the case, we need a fallback to emulate GtkSourceView's indentation.
(In reply to Christian Hergert from comment #1) > What language are you using? > > The indentation is provided by the indenter and it might be that we don't > have one for your language. If that is the case, we need a fallback to > emulate GtkSourceView's indentation. I'm testing the Rust language. Using Enter indents correctly, using o or O doesn't.
Created attachment 355129 [details] [review] indenter: add fallback when no indenter is supplied We can have a very simple indenter as a fallback for the interface. Just pass NULL for @self in those cases. This tries to mimic GtkSourceView in that it just copies the previous lines indentation (when possible). No indentation is performed if we land on the first line of the buffer.
Created attachment 355130 [details] [review] source-view: use fallback indentation when reasonble In some situations, we know we want to indent, but we don't have a smart indenter. We can instead fallback to a GtkSourceView- like indenter which copies the previous line. This is done by using NULL as the @self parameter to the various IdeIndenter API.
It was as I expected. We didn't have a fallback indenter with languages for which we do not have a smart indenter. I've added a fallback indenter which mimics GtkSourceView in that it just copies the previous lines indentation. This should hopefully land in tonights Nightly build of Builder. Attachment 355129 [details] pushed as 29bf2ad - indenter: add fallback when no indenter is supplied Attachment 355130 [details] pushed as c39cc42 - source-view: use fallback indentation when reasonble
I decided this was worthwhile to merge to our gnome-builder-3-24 branch too, so it should show up in an upcoming stable channel Builder release.