diff options
| author | Christian Zangl <laktak@cdak.net> | 2025-05-02 02:17:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-02 08:17:55 +0800 |
| commit | 887766228197b6d63746af8134ee777862b7bbb1 (patch) | |
| tree | e5c716d9d451ef08a235f9a033f3407fc8ab21ce /src | |
| parent | e9adefccdff050dd1bb52dff0a62f188e72ecd4c (diff) | |
| download | aichat-887766228197b6d63746af8134ee777862b7bbb1.tar.gz | |
fix: visual indication of Vi insert/normal model #897 (#1279)
Diffstat (limited to 'src')
| -rw-r--r-- | src/repl/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 97d8f84..73e0e9a 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -17,7 +17,9 @@ use crate::utils::{ }; use anyhow::{bail, Context, Result}; +use crossterm::cursor::SetCursorStyle; use fancy_regex::Regex; +use reedline::CursorConfig; use reedline::{ default_emacs_keybindings, default_vi_insert_keybindings, default_vi_normal_keybindings, ColumnarMenu, EditCommand, EditMode, Emacs, KeyCode, KeyModifiers, Keybindings, Reedline, @@ -263,11 +265,17 @@ Type ".help" for additional help. let highlighter = ReplHighlighter::new(config); let menu = Self::create_menu(); let edit_mode = Self::create_edit_mode(config); + let cursor_config = CursorConfig { + vi_insert: Some(SetCursorStyle::BlinkingBar), + vi_normal: Some(SetCursorStyle::SteadyBlock), + emacs: Some(SetCursorStyle::SteadyBlock), + }; let mut editor = Reedline::create() .with_completer(Box::new(completer)) .with_highlighter(Box::new(highlighter)) .with_menu(menu) .with_edit_mode(edit_mode) + .with_cursor_config(cursor_config) .with_quick_completions(true) .with_partial_completions(true) .use_bracketed_paste(true) |
