Fix document switcher plugin with multiple splitted view.
Needs ReviewPublic

Authored by tristanp on Apr 14 2019, 4:31 PM.

Details

Reviewers
None
Group Reviewers
KDevelop
Summary

When using multiple area indexes (splitted views) the document switcher
activated with Ctrl+Tab was always changing the document of the first
splitted view even if the second view was selected.

Looking at the plugin code, it uses a list of last enabled views (Sublime::View)
and activate a view thanks to Sublime::Window::activateView, but this function
only show a view in its container (Sublime:Container) which was used when adding
the view.

It tends to confirm that switching a view will always keep it in the same
area index.

To solve this issue, the behaviour of the document plugin (documentview) is
mimicked by using Sublime::[Url]Document instead of Sublime::View and call
openDocument from document controller. This function seems to automatically
detect if creating a new view is needed or a old can be reused depending on
the current area index.

Note: This is my first patch in this projet, please let me know if I miss anything.

Diff Detail

Repository
R32 KDevelop
Branch
switch_doc_1
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 10855
Build 10873: arc lint + arc unit
tristanp created this revision.Apr 14 2019, 4:31 PM
Restricted Application added a project: KDevelop. · View Herald TranscriptApr 14 2019, 4:31 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald Transcript
tristanp requested review of this revision.Apr 14 2019, 4:31 PM
apol added a subscriber: apol.Jun 30 2019, 8:22 AM

Please clean the patch of whitespace changes.

plugins/documentswitcher/documentswitcherplugin.cpp
174

This changes the behaviour. Earlier if the view wasn't a document, it would still be added. Did you intend to change this?

tristanp added inline comments.Aug 2 2019, 6:54 PM
plugins/documentswitcher/documentswitcherplugin.cpp
174

I hadn't though about this case. Do you have an example of view managed by this plugin (document switcher) but not tracking a document ?

tristanp added inline comments.Oct 1 2019, 6:12 PM
plugins/documentswitcher/documentswitcherplugin.cpp
174

You're right ! I checked inheritance of Sublime::View and Okteta is using it for binary files. I tested it and indeed it is supported by document switcher plugin.

I will have to back to view design but change activeView function to create a view if needed in last active area.