GNOME Bugzilla – Bug 760124
Can't go back from preview
Last modified: 2016-01-08 11:07:23 UTC
Going back from preview doesn't work if the document was opened from the search provider.
Created attachment 318217 [details] [review] windowMode: Go back from preview when launched from search provider
Review of attachment 318217 [details] [review]: Looks good to me, thanks.
Review of attachment 318217 [details] [review]: Thanks for working on this, Alessandro. I see that it regressed in commit cf1a4173a75f ::: src/windowMode.js @@ +53,3 @@ for (let i = 0; i < steps; i++) { oldMode = this._history.pop(); + if (oldMode == null) I would prefer to keep the WindowMode.NONE check. It's nice to assert the invariants because it provides a certain degree of sanity checking and prevents us from shooting ourselves in the foot. One option would be to split the if condition as: if (!oldMode) return; // <comment about why we allow this> if (this._mode == WindowMode.PREVIEW && oldMode == WindowMode.NONE) oldMode = WindowMode.OVERVIEW; if (oldMode == WindowMode.NONE) return; The !oldMode check is basically a sanity check to ensure that we have enough items in our history as the number of steps that have been requested. It might be more readable to move that check out of the for loop towards the top of the function, and just check if this._history.length >= steps. The other checks could similarly move out of the for loop.
Created attachment 318226 [details] [review] windowMode: Go back from preview when launched from search provider
Created attachment 318228 [details] [review] windowMode: Go back from preview when launched from search provider
Review of attachment 318228 [details] [review]: Looks good to me. Please push to master, gnome-3-18 and gnome-3-16.
Attachment 318228 [details] pushed as 2048481 - windowMode: Go back from preview when launched from search provider