# Path: sen/tui/commands/base.py
# def register_command(kls):
#     commands_mapping[kls.name] = kls
#     for a in kls.aliases:
#         commands_mapping[a] = kls
#     return kls
# 
# class SameThreadCommand(Command):
#     priority = SameThreadPriority()


import logging
import urwidtrees
from sen.tui.commands.base import register_command, SameThreadCommand
    name = "navigate-bottom"
    description = "go to last line"

    def run(self):
        # FIXME: refactor
        if isinstance(self.buffer.widget, urwidtrees.TreeBox):
            self.buffer.widget.focus_last()
        else:
            self.buffer.widget.set_focus(len(self.buffer.widget.body) - 1)
            self.buffer.widget.reload_widget()


@register_command
class NavigateUpCommand(SameThreadCommand):
    name = "navigate-up"
    description = "go one line up"

    def run(self):
        return super(self.buffer.widget.__class__, self.buffer.widget).keypress(self.size, "up")


@register_command
class NavigateDownCommand(SameThreadCommand):
    name = "navigate-down"
    description = "go one line down"

    def run(self):
        return super(self.buffer.widget.__class__, self.buffer.widget).keypress(self.size, "down")



# Path: sen/tui/commands/base.py
# def register_command(kls):
#     commands_mapping[kls.name] = kls
#     for a in kls.aliases:
#         commands_mapping[a] = kls
#     return kls
# 
# class SameThreadCommand(Command):
#     priority = SameThreadPriority()


# Path: sen/tui/commands/widget.py
import logging
import urwidtrees
from sen.tui.commands.base import register_command, SameThreadCommand

    name = "navigate-bottom"
    description = "go to last line"

    def run(self):
        # FIXME: refactor
        if isinstance(self.buffer.widget, urwidtrees.TreeBox):
            self.buffer.widget.focus_last()
        else:
            self.buffer.widget.set_focus(len(self.buffer.widget.body) - 1)
            self.buffer.widget.reload_widget()


@register_command
class NavigateUpCommand(SameThreadCommand):
    name = "navigate-up"
    description = "go one line up"

    def run(self):
        return super(self.buffer.widget.__class__, self.buffer.widget).keypress(self.size, "up")


@register_command
class NavigateDownCommand(SameThreadCommand):
    name = "navigate-down"
    description = "go one line down"

    def run(self):
        return super(self.buffer.widget.__class__, self.buffer.widget).keypress(self.size, "down")



@register_command