Commit 37cf7e34 authored by Bram Schoenmakers's avatar Bram Schoenmakers

'L' and 'R' swap the current column with the left/right neighbor

parent a17a0ef5
...@@ -215,6 +215,8 @@ class UIApplication(CLIApplicationBase): ...@@ -215,6 +215,8 @@ class UIApplication(CLIApplicationBase):
'E': self._edit_column, 'E': self._edit_column,
'D': self._delete_column, 'D': self._delete_column,
'Y': self._copy_column, 'Y': self._copy_column,
'L': self._swap_column_left,
'R': self._swap_column_right,
} }
try: try:
...@@ -273,6 +275,20 @@ class UIApplication(CLIApplicationBase): ...@@ -273,6 +275,20 @@ class UIApplication(CLIApplicationBase):
self.columns.focus_position = len(self.columns.contents) - 1 self.columns.focus_position = len(self.columns.contents) - 1
self._blur_commandline() self._blur_commandline()
def _swap_column_left(self):
pos = self.columns.focus_position
if pos > 0:
_columns = self.columns.contents
_columns[pos], _columns[pos - 1] = _columns[pos - 1], _columns[pos]
self.columns.focus_position -= 1
def _swap_column_right(self):
pos = self.columns.focus_position
_columns = self.columns.contents
if pos < len(_columns) - 1:
_columns[pos], _columns[pos + 1] = _columns[pos + 1], _columns[pos]
self.columns.focus_position += 1
@property @property
def _console_visible(self): def _console_visible(self):
contents = self.mainwindow.contents contents = self.mainwindow.contents
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment