GNOME Bugzilla – Bug 756405
make search in vim mode work more like vim
Last modified: 2015-10-12 15:14:14 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
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.
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.
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.
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.
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.
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.
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.
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.
Created attachment 313088 [details] [review] vim: add '?' keybinding The question mark is just like / but searches in reverse instead of forward.
Review of attachment 313080 [details] [review]: LGTM
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)
Review of attachment 313082 [details] [review]: LGTM, same g_return_if_reached
Review of attachment 313083 [details] [review]: LGTM
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.
Review of attachment 313085 [details] [review]: LGTM
Review of attachment 313086 [details] [review]: LGTM
Review of attachment 313087 [details] [review]: LGTM
Review of attachment 313088 [details] [review]: LGTM
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