docs and config adjustement
This commit is contained in:
77
canvas/docs/new_function_to_config.txt
Normal file
77
canvas/docs/new_function_to_config.txt
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
❯ git status
|
||||||
|
On branch main
|
||||||
|
Your branch is ahead of 'origin/main' by 1 commit.
|
||||||
|
(use "git push" to publish your local commits)
|
||||||
|
|
||||||
|
Changes not staged for commit:
|
||||||
|
(use "git add <file>..." to update what will be committed)
|
||||||
|
(use "git restore <file>..." to discard changes in working directory)
|
||||||
|
modified: src/canvas/actions/handlers/edit.rs
|
||||||
|
modified: src/canvas/actions/types.rs
|
||||||
|
|
||||||
|
no changes added to commit (use "git add" and/or "git commit -a")
|
||||||
|
❯ git --no-pager diff
|
||||||
|
diff --git a/canvas/src/canvas/actions/handlers/edit.rs b/canvas/src/canvas/actions/handlers/edit.rs
|
||||||
|
index a26fe6f..fa1becb 100644
|
||||||
|
--- a/canvas/src/canvas/actions/handlers/edit.rs
|
||||||
|
+++ b/canvas/src/canvas/actions/handlers/edit.rs
|
||||||
|
@@ -29,6 +29,21 @@ pub async fn handle_edit_action<S: CanvasState>(
|
||||||
|
Ok(ActionResult::success())
|
||||||
|
}
|
||||||
|
|
||||||
|
+ CanvasAction::SelectAll => {
|
||||||
|
+ // Select all text in current field
|
||||||
|
+ let current_input = state.get_current_input();
|
||||||
|
+ let text_length = current_input.len();
|
||||||
|
+
|
||||||
|
+ // Set cursor to start and select all
|
||||||
|
+ state.set_current_cursor_pos(0);
|
||||||
|
+ // TODO: You'd need to add selection state to CanvasState trait
|
||||||
|
+ // For now, just move cursor to end to "select" all
|
||||||
|
+ state.set_current_cursor_pos(text_length);
|
||||||
|
+ *ideal_cursor_column = text_length;
|
||||||
|
+
|
||||||
|
+ Ok(ActionResult::success_with_message(&format!("Selected all {} characters", text_length)))
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
CanvasAction::DeleteBackward => {
|
||||||
|
let cursor_pos = state.current_cursor_pos();
|
||||||
|
if cursor_pos > 0 {
|
||||||
|
@@ -323,6 +338,13 @@ impl ActionHandlerIntrospection for EditHandler {
|
||||||
|
is_required: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
+ actions.push(ActionSpec {
|
||||||
|
+ name: "select_all".to_string(),
|
||||||
|
+ description: "Select all text in current field".to_string(),
|
||||||
|
+ examples: vec!["Ctrl+a".to_string()],
|
||||||
|
+ is_required: false, // Optional action
|
||||||
|
+ });
|
||||||
|
+
|
||||||
|
HandlerCapabilities {
|
||||||
|
mode_name: "edit".to_string(),
|
||||||
|
actions,
|
||||||
|
diff --git a/canvas/src/canvas/actions/types.rs b/canvas/src/canvas/actions/types.rs
|
||||||
|
index 433a4d5..3794596 100644
|
||||||
|
--- a/canvas/src/canvas/actions/types.rs
|
||||||
|
+++ b/canvas/src/canvas/actions/types.rs
|
||||||
|
@@ -31,6 +31,8 @@ pub enum CanvasAction {
|
||||||
|
NextField,
|
||||||
|
PrevField,
|
||||||
|
|
||||||
|
+ SelectAll,
|
||||||
|
+
|
||||||
|
// Autocomplete actions
|
||||||
|
TriggerAutocomplete,
|
||||||
|
SuggestionUp,
|
||||||
|
@@ -62,6 +64,7 @@ impl CanvasAction {
|
||||||
|
"move_word_end_prev" => Self::MoveWordEndPrev,
|
||||||
|
"next_field" => Self::NextField,
|
||||||
|
"prev_field" => Self::PrevField,
|
||||||
|
+ "select_all" => Self::SelectAll,
|
||||||
|
"trigger_autocomplete" => Self::TriggerAutocomplete,
|
||||||
|
"suggestion_up" => Self::SuggestionUp,
|
||||||
|
"suggestion_down" => Self::SuggestionDown,
|
||||||
|
╭─ ~/Doc/p/komp_ac/canvas on main ⇡1 !2
|
||||||
|
╰─
|
||||||
|
|
||||||
@@ -1,58 +1,52 @@
|
|||||||
# canvas_config.toml - Complete Canvas Configuration
|
[keybindings.edit]
|
||||||
|
# Required
|
||||||
[behavior]
|
move_right = ["Right", "l"]
|
||||||
wrap_around_fields = true
|
delete_char_backward = ["Backspace"]
|
||||||
auto_save_on_field_change = false
|
next_field = ["Tab", "Enter"]
|
||||||
word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"
|
move_up = ["Up", "k"]
|
||||||
max_suggestions = 6
|
move_down = ["Down", "j"]
|
||||||
|
prev_field = ["Shift+Tab"]
|
||||||
[appearance]
|
move_left = ["Left", "h"]
|
||||||
cursor_style = "block" # "block", "bar", "underline"
|
# Optional
|
||||||
show_field_numbers = false
|
move_last_line = ["Ctrl+End", "G"]
|
||||||
highlight_current_field = true
|
delete_char_forward = ["Delete"]
|
||||||
|
move_word_prev = ["Ctrl+Left", "b"]
|
||||||
# Read-only mode keybindings (vim-style)
|
|
||||||
[keybindings.read_only]
|
|
||||||
move_left = ["h"]
|
|
||||||
move_right = ["l"]
|
|
||||||
move_up = ["k"]
|
|
||||||
move_down = ["j"]
|
|
||||||
move_word_next = ["w"]
|
|
||||||
move_word_end = ["e"]
|
move_word_end = ["e"]
|
||||||
move_word_prev = ["b"]
|
|
||||||
move_word_end_prev = ["ge"]
|
move_word_end_prev = ["ge"]
|
||||||
|
move_first_line = ["Ctrl+Home", "gg"]
|
||||||
|
move_word_next = ["Ctrl+Right", "w"]
|
||||||
|
move_line_start = ["Home", "0"]
|
||||||
|
move_line_end = ["End", "$"]
|
||||||
|
|
||||||
|
[keybindings.highlight]
|
||||||
|
# Required
|
||||||
|
move_left = ["h", "Left"]
|
||||||
|
move_right = ["l", "Right"]
|
||||||
|
move_up = ["k", "Up"]
|
||||||
|
move_down = ["j", "Down"]
|
||||||
|
# Optional
|
||||||
|
move_word_next = ["w"]
|
||||||
move_line_start = ["0"]
|
move_line_start = ["0"]
|
||||||
move_line_end = ["$"]
|
move_line_end = ["$"]
|
||||||
|
move_word_prev = ["b"]
|
||||||
|
move_word_end = ["e"]
|
||||||
|
|
||||||
|
[keybindings.read_only]
|
||||||
|
# Required
|
||||||
|
move_up = ["k", "Up"]
|
||||||
|
move_left = ["h", "Left"]
|
||||||
|
move_right = ["l", "Right"]
|
||||||
|
move_down = ["j", "Down"]
|
||||||
|
# Optional
|
||||||
|
move_line_end = ["$"]
|
||||||
|
move_word_next = ["w"]
|
||||||
|
next_field = ["Tab"]
|
||||||
|
move_word_prev = ["b"]
|
||||||
|
move_word_end = ["e"]
|
||||||
|
move_last_line = ["G"]
|
||||||
|
move_word_end_prev = ["ge"]
|
||||||
|
move_line_start = ["0"]
|
||||||
move_first_line = ["gg"]
|
move_first_line = ["gg"]
|
||||||
move_last_line = ["shift+g"]
|
|
||||||
next_field = ["Tab"]
|
|
||||||
prev_field = ["Shift+Tab"]
|
prev_field = ["Shift+Tab"]
|
||||||
|
|
||||||
# Edit mode keybindings
|
|
||||||
[keybindings.edit]
|
|
||||||
delete_char_backward = ["Backspace"]
|
|
||||||
delete_char_forward = ["Delete"]
|
|
||||||
move_left = ["Left"]
|
|
||||||
move_right = ["Right"]
|
|
||||||
move_up = ["Up"]
|
|
||||||
move_down = ["Down"]
|
|
||||||
move_line_start = ["Home"]
|
|
||||||
move_line_end = ["End"]
|
|
||||||
move_word_next = ["Ctrl+Right"]
|
|
||||||
move_word_prev = ["Ctrl+Left"]
|
|
||||||
next_field = ["Tab"]
|
|
||||||
prev_field = ["Shift+Tab"]
|
|
||||||
trigger_autocomplete = ["Ctrl+p"]
|
|
||||||
|
|
||||||
# Suggestion/autocomplete keybindings
|
|
||||||
[keybindings.suggestions]
|
|
||||||
suggestion_up = ["Up", "Ctrl+p"]
|
|
||||||
suggestion_down = ["Down", "Ctrl+n"]
|
|
||||||
select_suggestion = ["Enter", "Tab"]
|
|
||||||
exit_suggestions = ["Esc"]
|
|
||||||
trigger_autocomplete = ["Tab"]
|
|
||||||
|
|
||||||
# Global keybindings (work in both modes)
|
|
||||||
[keybindings.global]
|
|
||||||
move_up = ["Up"]
|
|
||||||
move_down = ["Down"]
|
|
||||||
|
|||||||
@@ -42,10 +42,42 @@ next_entry = ["right","1"]
|
|||||||
enter_highlight_mode = ["v"]
|
enter_highlight_mode = ["v"]
|
||||||
enter_highlight_mode_linewise = ["ctrl+v"]
|
enter_highlight_mode_linewise = ["ctrl+v"]
|
||||||
|
|
||||||
|
### AUTOGENERATED CANVAS CONFIG
|
||||||
|
# Required
|
||||||
|
move_up = ["k", "Up"]
|
||||||
|
move_left = ["h", "Left"]
|
||||||
|
move_right = ["l", "Right"]
|
||||||
|
move_down = ["j", "Down"]
|
||||||
|
# Optional
|
||||||
|
move_line_end = ["$"]
|
||||||
|
move_word_next = ["w"]
|
||||||
|
next_field = ["Tab"]
|
||||||
|
move_word_prev = ["b"]
|
||||||
|
move_word_end = ["e"]
|
||||||
|
move_last_line = ["G"]
|
||||||
|
move_word_end_prev = ["ge"]
|
||||||
|
move_line_start = ["0"]
|
||||||
|
move_first_line = ["gg"]
|
||||||
|
prev_field = ["Shift+Tab"]
|
||||||
|
|
||||||
[keybindings.highlight]
|
[keybindings.highlight]
|
||||||
exit_highlight_mode = ["esc"]
|
exit_highlight_mode = ["esc"]
|
||||||
enter_highlight_mode_linewise = ["ctrl+v"]
|
enter_highlight_mode_linewise = ["ctrl+v"]
|
||||||
|
|
||||||
|
### AUTOGENERATED CANVAS CONFIG
|
||||||
|
# Required
|
||||||
|
move_left = ["h", "Left"]
|
||||||
|
move_right = ["l", "Right"]
|
||||||
|
move_up = ["k", "Up"]
|
||||||
|
move_down = ["j", "Down"]
|
||||||
|
# Optional
|
||||||
|
move_word_next = ["w"]
|
||||||
|
move_line_start = ["0"]
|
||||||
|
move_line_end = ["$"]
|
||||||
|
move_word_prev = ["b"]
|
||||||
|
move_word_end = ["e"]
|
||||||
|
|
||||||
|
|
||||||
[keybindings.edit]
|
[keybindings.edit]
|
||||||
# BIG CHANGES NOW EXIT HANDLES EITHER IF THOSE
|
# BIG CHANGES NOW EXIT HANDLES EITHER IF THOSE
|
||||||
# exit_edit_mode = ["esc","ctrl+e"]
|
# exit_edit_mode = ["esc","ctrl+e"]
|
||||||
@@ -53,13 +85,30 @@ enter_highlight_mode_linewise = ["ctrl+v"]
|
|||||||
# select_suggestion = ["enter"]
|
# select_suggestion = ["enter"]
|
||||||
# next_field = ["enter"]
|
# next_field = ["enter"]
|
||||||
enter_decider = ["enter"]
|
enter_decider = ["enter"]
|
||||||
prev_field = ["shift+enter"]
|
|
||||||
exit = ["esc", "ctrl+e"]
|
exit = ["esc", "ctrl+e"]
|
||||||
delete_char_forward = ["delete"]
|
|
||||||
delete_char_backward = ["backspace"]
|
|
||||||
suggestion_down = ["ctrl+n", "tab"]
|
suggestion_down = ["ctrl+n", "tab"]
|
||||||
suggestion_up = ["ctrl+p", "shift+tab"]
|
suggestion_up = ["ctrl+p", "shift+tab"]
|
||||||
|
|
||||||
|
### AUTOGENERATED CANVAS CONFIG
|
||||||
|
# Required
|
||||||
|
move_right = ["Right", "l"]
|
||||||
|
delete_char_backward = ["Backspace"]
|
||||||
|
next_field = ["Tab", "Enter"]
|
||||||
|
move_up = ["Up", "k"]
|
||||||
|
move_down = ["Down", "j"]
|
||||||
|
prev_field = ["Shift+Tab"]
|
||||||
|
move_left = ["Left", "h"]
|
||||||
|
# Optional
|
||||||
|
move_last_line = ["Ctrl+End", "G"]
|
||||||
|
delete_char_forward = ["Delete"]
|
||||||
|
move_word_prev = ["Ctrl+Left", "b"]
|
||||||
|
move_word_end = ["e"]
|
||||||
|
move_word_end_prev = ["ge"]
|
||||||
|
move_first_line = ["Ctrl+Home", "gg"]
|
||||||
|
move_word_next = ["Ctrl+Right", "w"]
|
||||||
|
move_line_start = ["Home", "0"]
|
||||||
|
move_line_end = ["End", "$"]
|
||||||
|
|
||||||
[keybindings.command]
|
[keybindings.command]
|
||||||
exit_command_mode = ["ctrl+g", "esc"]
|
exit_command_mode = ["ctrl+g", "esc"]
|
||||||
command_execute = ["enter"]
|
command_execute = ["enter"]
|
||||||
@@ -77,3 +126,9 @@ keybinding_mode = "vim" # Options: "default", "vim", "emacs"
|
|||||||
[colors]
|
[colors]
|
||||||
theme = "dark"
|
theme = "dark"
|
||||||
# Options: "light", "dark", "high_contrast"
|
# Options: "light", "dark", "high_contrast"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user