def execute(self, key: int, model: Model): padding_len: int = model.get_padding_len() if model.at_field_end(LateralDirection.RIGHT): num_spaces = padding_len else: num_spaces = 1 model.move(LateralDirection.RIGHT, num_spaces)
def execute(self, key: int, model: Model): right = LateralDirection.RIGHT if model.at_field_end(right): model.move( right, model.get_padding_len() + len(model.get_neighbor_field(right))) else: model.move_field_end(right)
def execute(self, key: int, model: Model): model.split_field()
def is_relevant(self, key: int, model: Model): return key == self.key_map.value(Key.TAB) and not model.at_line_start()
def execute(self, key: int, model: Model): model.combine_nodes()
def execute(self, key: int, model: Model): model.move_end(LateralDirection.RIGHT)
def execute(self, key: int, model: Model): model.delete(-1)
def execute(self, key: int, model: Model): model.insert(chr(key))
def is_relevant(self, key: int, model: Model): return key == self.key_map.value(Key.DELETE) and not model.at_line_end() \ and model.at_field_end(LateralDirection.RIGHT)
def execute(self, key: int, model: Model): model.toggle_current_node_collapsed()
def execute(self, key: int, model: Model): model.move(VerticalDirection.DOWN)
def is_relevant(self, key: int, model: Model): return key == self.key_map.value( Key.CTRL_RIGHT) and not model.at_line_end()
def execute(self, key: int, model: Model): left = LateralDirection.LEFT if model.at_field_end(left): model.move(left, model.get_neighbor_column_width(left)) else: model.move_field_end(left)
def execute(self, key: int, model: Model): model.move(LateralDirection.LEFT)
def is_relevant(self, key: int, model: Model): return not model.at_root() and (key == self.key_map.value(Key.BACKSPACE) and model.at_line_start()) \ or key == self.key_map.value(Key.SHIFT_TAB)
def execute(self, key: int, model: Model): model.save()
def execute(self, key: int, model: Model): model.unindent_current_node()
def execute(self, key: int, model: Model): model.signal_user_error()
def execute(self, key: int, model: Model): model.combine_fields(LateralDirection.RIGHT)
def execute(self, key: int, model: Model): model.split_node()
def is_relevant(self, key: int, model: Model): return key == self.key_map.value( Key.BACKSPACE) and not model.at_field_end(LateralDirection.LEFT)
def is_relevant(self, key: int, model: Model): return model.get_level() == 0 and key == self.key_map.value( Key.BACKSPACE) and model.at_line_start() and not model.at_root()
def main(window): file_path = get_file_path() view = LinuxView(window) model = Model(view, file_path) controller: Controller = Controller(model) controller.run()
def execute(self, key, model: Model): model.page(VerticalDirection.UP)