Thursday, June 9, 2011

KDevelop: Browser Like Tabs

After the very nice week in Randa at the KDevelop sprint - which I enjoyed a lot (big thanks to Mario and his helpers for that) -  I'd like to present an idea for a fundamental UI change for KDevelop I had for quite some time.
The problem I want to solve is that due to the very good code navigation features you end up with many many open files - which are displayed as tabs. And tabs just don't scale - the only thing that helps is regular closing.
When "browsing" source code, you normally browse like with a web browser. And I think everybody would agree that opening a new tab for every clicked link would be stupid. In a web browser the user has the choice. Ctrl+Click opens a new tab, a normal click navigates to the link in the current tab. When entering an url the same - by default stay in the same tab, but the user can choose to open a new tab first.
And exactly that I implemented for KDevelop:
  •  by default open in current tab
    • except: current file as unsaved changes
    • or: current tab is marked as "Sticky" (as in "Keep it open, I want to edit that file")
  • Keyboard modifiers for actions that open files
    • Code navigation in document: Ctrl+Shift+Click (instead of Ctrl+Click)
    • Ctrl+Enter in Quick Open
    • Ctrl+Click in Project View
If this sounds interesting for you - give it a try! Checkout the "browser-like-tabs" branch in kdevplatfrom and kdevelop:

git clone git://anongit.kde.org/kdevplatform
git checkout browser-like-tabs
mkdir build && cd build && cmake .. && make && make install

git clone git://anongit.kde.org/kdevelop
git checkout browser-like-tabs
mkdir build && cd build && cmake .. && make && make install

Activate the feature in Configuration -> UI Configuration -> Browser like tabs checkbox. (It's disabled by default) Try to get used to it, and send us your thoughts to our mailing list.

TODO:
  • The history navigation is broken
  • Modifiers for Filesystem view and Grep view
  • Find solution for Ctrl+Dbl-Click in project view extends selection

5 comments:

  1. I've just built this to try it out.

    I'll let you know how I get on.

    ReplyDelete
  2. Eclipse does something similar, its quite intelligent. Works something along the lines: Doing "open declaration" in a file creates a new tab with the target type. When doing the same in this new tab the editor is replaced with the next file etc. Other actions like "quick open" still open a new tab. I'm not sure what happens with results from code-searches (i.e. find all declarations of a function, find all uses etc.), but I think those will also be opened in the same tab.

    That being said, I have love-hate relationship with this feature :) Its often nice, but sometimes it requires me to go through extra steps to keep multiple files open that I want to switch back/forth between.

    Anyway, its definetly an interesting idea to solve the tab-problem and worth pursuing.

    ReplyDelete
  3. Also, could you add an option to open a declaration/definition in a split view rather than a new tab?

    I have a widescreen monitor and I would probably change the Ctrl+Click to that if you implement it.

    :)

    ReplyDelete
  4. @shocklateboy:
    hm, I don't see how this could be done. Open a new split view for every click? Or use two and always switch to the other one? Or use the "buddy"-feature for that and open h/cpp in separate split views?

    ReplyDelete
  5. @Niko If I could suggest, may be give also a thought to this bug: https://bugs.kde.org/show_bug.cgi?id=274209

    ReplyDelete