Keyboard navigation for TextMate stacktraces

Jun 29 2008

Keyboard navigation for TextMate stacktraces

Put this script at the end of /Applications/TextMate.app/Contents/SharedSupport/Support/script/webpreview.js.

document.addEventListener('keypress', function(e){
    var key = e.keyCode
    if (key != 63233 && key != 63232) return
    links = document.getElementsByTagName('a')
    for (var i = 1; i < links.length; i++)
        if (links[i].title == 'focused') break
    if (i == links.length) i = 0
    links[i].title = null
    if (key == 63233){
        if (i == (links.length - 1)) i = 1
        else i += 1
    }
    if (key == 63232){
        if (i <= 1) i = links.length - 1
        else i -= 1
    }
    links[i].title = 'focused'
    links[i].focus()
})

Incredibly useful when I am running my tests!

No responses yet

Leave a Reply