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 756405 - make search in vim mode work more like vim
make search in vim mode work more like vim
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: editor
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-11 20:32 UTC by Ray Strode [halfline]
Modified: 2015-10-12 15:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
source-view: add search-direction property (29.59 KB, patch)
2015-10-11 20:32 UTC, Ray Strode [halfline]
committed Details | Review
source-view: allow TAB_FORWARD / TAB_BACKWARD in move_search (3.98 KB, patch)
2015-10-11 20:32 UTC, Ray Strode [halfline]
committed Details | Review
source-view: honor search-direction when doing rubberband search (3.92 KB, patch)
2015-10-11 20:33 UTC, Ray Strode [halfline]
committed Details | Review
editor-frame: pass direction to find action (10.14 KB, patch)
2015-10-11 20:33 UTC, Ray Strode [halfline]
committed Details | Review
editor-frame: store search direction from find action (3.09 KB, patch)
2015-10-11 20:33 UTC, Ray Strode [halfline]
committed Details | Review
editor-frame: make next/previous search in current search direction (3.21 KB, patch)
2015-10-11 20:33 UTC, Ray Strode [halfline]
committed Details | Review
editor-frame: change search direction when up and down arrow are pressed (3.52 KB, patch)
2015-10-11 20:33 UTC, Ray Strode [halfline]
committed Details | Review
vim: make n/shift-n follow current search direction (6.25 KB, patch)
2015-10-11 20:33 UTC, Ray Strode [halfline]
committed Details | Review
vim: add '?' keybinding (3.12 KB, patch)
2015-10-11 20:33 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2015-10-11 20:32:51 UTC
This patchset fixes up search a bit to keep track of the
current search direction and make "n" follow the search direction.

These features also allow us to add back '?' keybinding, and should
help getting emacs CTRL-R work better, too.

Works best on top of bug 756404
Comment 1 Ray Strode [halfline] 2015-10-11 20:32:54 UTC
Created attachment 313080 [details] [review]
source-view: add search-direction property

This commit adds a search-direction property to the source view that
tracks a direction to be later used for setting which way next/previous
search results goes.
Comment 2 Ray Strode [halfline] 2015-10-11 20:32:58 UTC
Created attachment 313081 [details] [review]
source-view: allow TAB_FORWARD / TAB_BACKWARD in move_search

Now that we have a search-direction property we should treat
TAB_FORWARD and TAB_BACKWARD as meaning search relative to
the current search direction.

This commit allows TAB_FORWARD / TAB_BACKWARD in move_search
and translates them to an absolute search direction.
Comment 3 Ray Strode [halfline] 2015-10-11 20:33:01 UTC
Created attachment 313082 [details] [review]
source-view: honor search-direction when doing rubberband search

Right now we always do rubberband search in the forward direction.
This commit changes it to instead search in the current search
direction.
Comment 4 Ray Strode [halfline] 2015-10-11 20:33:12 UTC
Created attachment 313083 [details] [review]
editor-frame: pass direction to find action

We're going to need to be able to set an initial
search direction when initiating a find operation.
This commit does the plumbing to get the direction
sent from the keybinding to the code.
Comment 5 Ray Strode [halfline] 2015-10-11 20:33:16 UTC
Created attachment 313084 [details] [review]
editor-frame: store search direction from find action

The find action now passes a direction with it, this
commit saves that direction on the view for future use.
Comment 6 Ray Strode [halfline] 2015-10-11 20:33:19 UTC
Created attachment 313085 [details] [review]
editor-frame: make next/previous search in current search direction

Right now they hardcode UP and DOWN, but they should follow the
current search direction.
Comment 7 Ray Strode [halfline] 2015-10-11 20:33:23 UTC
Created attachment 313086 [details] [review]
editor-frame: change search direction when up and down arrow are pressed

Rather than making UP search backwards and DOWN search forwards, making
them set the current search direction, and then search in the same
direction as the current search direction.
Comment 8 Ray Strode [halfline] 2015-10-11 20:33:27 UTC
Created attachment 313087 [details] [review]
vim: make n/shift-n follow current search direction

n and shift-n are supposed to follow the current search
direction, make sure that they do.
Comment 9 Ray Strode [halfline] 2015-10-11 20:33:31 UTC
Created attachment 313088 [details] [review]
vim: add '?' keybinding

The question mark is just like / but searches in reverse instead
of forward.
Comment 10 Christian Hergert 2015-10-11 21:09:06 UTC
Review of attachment 313080 [details] [review]:

LGTM
Comment 11 Christian Hergert 2015-10-11 21:10:05 UTC
Review of attachment 313081 [details] [review]:

Use g_return_if_reached() instead of g_assert_if_reached() which can be compiled out. (Or we get warnings on optimized builds)
Comment 12 Christian Hergert 2015-10-11 21:10:49 UTC
Review of attachment 313082 [details] [review]:

LGTM, same g_return_if_reached
Comment 13 Christian Hergert 2015-10-11 21:24:43 UTC
Review of attachment 313083 [details] [review]:

LGTM
Comment 14 Christian Hergert 2015-10-11 21:25:51 UTC
Review of attachment 313084 [details] [review]:

LGTM. I'm not sure if any of our compiler options will warn about int->enum without a cast.
Comment 15 Christian Hergert 2015-10-11 21:26:24 UTC
Review of attachment 313085 [details] [review]:

LGTM
Comment 16 Christian Hergert 2015-10-11 21:27:27 UTC
Review of attachment 313086 [details] [review]:

LGTM
Comment 17 Christian Hergert 2015-10-11 21:28:11 UTC
Review of attachment 313087 [details] [review]:

LGTM
Comment 18 Christian Hergert 2015-10-11 21:28:34 UTC
Review of attachment 313088 [details] [review]:

LGTM
Comment 19 Ray Strode [halfline] 2015-10-12 15:13:34 UTC
Attachment 313080 [details] pushed as 7b490c3 - source-view: add search-direction property
Attachment 313081 [details] pushed as cb0f6ac - source-view: allow TAB_FORWARD / TAB_BACKWARD in move_search
Attachment 313082 [details] pushed as 9b5fcaa - source-view: honor search-direction when doing rubberband search
Attachment 313083 [details] pushed as d4c3932 - editor-frame: pass direction to find action
Attachment 313084 [details] pushed as fbf8da5 - editor-frame: store search direction from find action
Attachment 313085 [details] pushed as a915c26 - editor-frame: make next/previous search in current search direction
Attachment 313086 [details] pushed as 73e0775 - editor-frame: change search direction when up and down arrow are pressed
Attachment 313087 [details] pushed as 1294261 - vim: make n/shift-n follow current search direction
Attachment 313088 [details] pushed as bb3d2dc - vim: add '?' keybinding