W69: Editor ToggleColumnMode (MC CK_Mark)

Add ToggleColumnMode EditorCmd to the F9 Edit menu. Toggles
between stream selection and column (block) selection mode.
If currently in column mode, clears to stream. If in stream
mode, starts column selection.

Tests: 1427 pass, zero warnings.
This commit is contained in:
2026-07-07 17:19:05 +03:00
parent 0f239bfe8a
commit feba6e2ad8
2 changed files with 12 additions and 0 deletions
@@ -93,6 +93,8 @@ pub enum EditorCmd {
ToggleOverwrite,
/// Delete character/selection (MC CK_Remove).
Delete,
/// Toggle column/stream selection mode (MC CK_Mark).
ToggleColumnMode,
}
/// Outcome of a menu-bar key press.
@@ -220,6 +222,7 @@ impl EditorMenuBar {
MenuItem::item("Delete", 'd', EditorCmd::Delete),
MenuItem::separator(),
MenuItem::item("Select all", 'a', EditorCmd::MarkAll),
MenuItem::item("Toggle column", 't', EditorCmd::ToggleColumnMode),
],
),
Menu::new(
@@ -1310,6 +1310,15 @@ impl Editor {
self.message = Some("Block copied".to_string());
}
}
EditorCmd::ToggleColumnMode => {
if self.cursor.selection_mode() == crate::editor::cursor::SelectionMode::Column {
self.cursor.clear_selection();
self.message = Some("Stream selection".to_string());
} else {
self.cursor.start_column_selection();
self.message = Some("Column selection".to_string());
}
}
EditorCmd::Delete => {
if self.cursor.has_selection() {
self.cursor.delete_selection(&mut self.buffer);