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 784633 - Vim mode: o and O don't autoindent the newly inserted line
Vim mode: o and O don't autoindent the newly inserted line
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: editor
Flatpak Nightly Channel
Other Linux
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-07-06 19:24 UTC by Ivan Molodetskikh
Modified: 2017-07-07 22:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
indenter: add fallback when no indenter is supplied (4.99 KB, patch)
2017-07-07 22:50 UTC, Christian Hergert
committed Details | Review
source-view: use fallback indentation when reasonble (3.41 KB, patch)
2017-07-07 22:50 UTC, Christian Hergert
committed Details | Review

Description Ivan Molodetskikh 2017-07-06 19:24:08 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.
Comment 1 Christian Hergert 2017-07-06 19:33:09 UTC
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.
Comment 2 Ivan Molodetskikh 2017-07-06 19:41:22 UTC
(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.
Comment 3 Christian Hergert 2017-07-07 22:50:00 UTC
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.
Comment 4 Christian Hergert 2017-07-07 22:50:03 UTC
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.
Comment 5 Christian Hergert 2017-07-07 22:52:35 UTC
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
Comment 6 Christian Hergert 2017-07-07 22:54:45 UTC
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.