« »

History feature in Komodo 5.1.0 alpha 1

Wednesday, 04 February 2009

We released Komodo 5.1.0 alpha 1 today! Get it here:


Please try it out and give us your feedback:


This is the first release of Komodo 5.1 on the way to a planned final release around mid-May [Update: mid-March. Subconsciously I keep hoping for more time. :)]. (I'll write about our Komodo 5.1 plans in a separate post). Here I want to talk about Komodo's new "History" feature.

History overview

screenshot of Komodo 5.1's history feature

Komodo's History feature is like your browser's history, but for the editor. Back and Forward buttons in the toolbar. Same default keybindings as in Firefox 1. Simple.

Komodo's history is a bit different than a browser's. In a browser, you have a separate history session for each tab. This doesn't make as much sense for an editor. Komodo's history is per-window 2. That means that the Back button will move you back to the last place you were, be that in the current file or in another file in the same window. This means that jumping back:

  • after a Go To Definition, or
  • after opening a new file, or
  • after jumping to a find result

is as easy as clicking "Back".

More than any new feature in Komodo, the first time we hooked the feature up it felt immediately useful. Of course, this is just an alpha release so there is lots of polishing to do. Read on for some of the other things we hope to do with this.

Future work

Some other things Komodo will be able to support with this:

  • Opening recent files quickly. Chances are good that a file you want to open in your editor is a file you've edited before (and recently). The history database now provides Komodo with the data it needs to support that.
  • Find in recent files. Often I'll want to look at some snippet of code that I remember writing in the last few days, but can't remember what file (or even what project) that was in.
  • Support '' command in Vi-mode. From the Vim help:

    ''  ``                  Move to the position before latest jump.
  • Hooking Back and Forward into the MS Intellimouse's (and other mice, I suspect) side buttons -- as is the default in Firefox.

Backend code

For those interested, most of the backend of the history system is here in "editorhistory.py" in the Open Komodo subversion repository.

For JavaScript code (most interesting to Komodo extension developers) there is a new ko.history API with the most relevant methods being:

  • ko.history.note_curr_loc(view): Tell the history system to note the current editor location before jumping somewhere.
  • ko.history.history_back(n): Go back n locations.
  • ko.history.history_forward(n): Go forward n locations.

Komodo's history database shares some ideas with Firefox 3's Places database. In particular the idea of splitting visited locations (URLs in Firefox, editor locations in Komodo) and visits into separate database tables was helpful. They are, of course, both SQLite3 databases.

  1. The keybindings aren't yet there for Mac OS X in alpha 1. They will be there for alpha 2. 

  2. Currently it is shared by multiple Komodo windows, but will be changed to be per window. 

Tagged: komodo, activestate, mozilla