<commit_before>-- alnbox, alignment viewer based on the curses library
-- Copyright (C) 2015 <NAME>
-- See the LICENSE file for terms of use

-- listen keyboard and call appropriate methods of AlnWindow
return function(aw, refresh, getch)
    local cursesConsts = require 'alnbox.cursesConsts'

    aw:drawAll()

    while true do
        refresh()
        local ch = getch()
        if ch == cursesConsts.KEY_UP then
            aw:moveUp()
        elseif ch == cursesConsts.KEY_DOWN then
            aw:moveDown()
        elseif ch == cursesConsts.KEY_RIGHT then
            aw:moveRight()
        elseif ch == cursesConsts.KEY_LEFT then
            aw:moveLeft()
        elseif ch == cursesConsts.KEY_PPAGE then
            aw:moveUpEnd()
        elseif ch == cursesConsts.KEY_NPAGE then
            aw:moveDownEnd()
        elseif ch == cursesConsts.KEY_END then
            aw:moveRightEnd()
        elseif ch == cursesConsts.KEY_HOME then
            aw:moveLeftEnd()
        elseif ch == string.byte('q') then
            break
        end
    end
end<commit_msg>navigate gets custom bindings<commit_after>-- alnbox, alignment viewer based on the curses library
-- Copyright (C) 2015 <NAME>
-- See the LICENSE file for terms of use

-- listen keyboard and call appropriate methods of AlnWindow
return function(aw, refresh, getch, bindings)
    local cursesConsts = require 'alnbox.cursesConsts'

    aw:drawAll()

    while true do
        refresh()
        local ch = getch()
        if ch == cursesConsts.KEY_UP then
            aw:moveUp()
        elseif ch == cursesConsts.KEY_DOWN then
            aw:moveDown()
        elseif ch == cursesConsts.KEY_RIGHT then
            aw:moveRight()
        elseif ch == cursesConsts.KEY_LEFT then
            aw:moveLeft()
        elseif ch == cursesConsts.KEY_PPAGE then
            aw:moveUpEnd()
        elseif ch == cursesConsts.KEY_NPAGE then
            aw:moveDownEnd()
        elseif ch == cursesConsts.KEY_END then
            aw:moveRightEnd()
        elseif ch == cursesConsts.KEY_HOME then
            aw:moveLeftEnd()
        elseif ch == string.byte('q') then
            break
        elseif bindings and bindings[ch] then
            local func = bindings[ch]
            func()
        end
    end
end
{'fraction_non_alphanumeric': 0.08021154693697664, 'fraction_numerical': 0.0035257822829440283, 'mean_word_length': 2.0634278002699054, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2814907', 'n_tokens_mistral': 659, 'n_tokens_neox': 656, 'n_words': 198}