# 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
"""
widget specific commands
"""






logger = logging.getLogger(__name__)


@register_command
class NavigateTopCommand(SameThreadCommand):
    name = "navigate-top"
    description = "go to first line"

    def run(self):
        # FIXME: refactor
        if isinstance(self.buffer.widget, urwidtrees.TreeBox):
            self.buffer.widget.focus_first()
        else:
            self.buffer.widget.set_focus(0)
            self.buffer.widget.reload_widget()


@register_command

# 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

"""
widget specific commands
"""






logger = logging.getLogger(__name__)


@register_command
class NavigateTopCommand(SameThreadCommand):
    name = "navigate-top"
    description = "go to first line"

    def run(self):
        # FIXME: refactor
        if isinstance(self.buffer.widget, urwidtrees.TreeBox):
            self.buffer.widget.focus_first()
        else:
            self.buffer.widget.set_focus(0)
            self.buffer.widget.reload_widget()


@register_command

class NavigateBottomCommand(SameThreadCommand):