nushell / reedline

A feature-rich line editor - powering Nushell
https://docs.rs/reedline/
MIT License
549 stars 154 forks source link

Selection in VI visual mode need to include the last character (+1 grapheme to the right) #843

Open blindFS opened 1 month ago

blindFS commented 1 month ago

Platform macOS Terminal software wezterm

https://github.com/user-attachments/assets/57347516-eeed-441e-b1b8-02cb1f1111de

This is not what a traditional vim behavior where current character "a" should be included in both directions. Basically, the end offset returned by get_selection should be increased to the next grapheme.

Steps to reproduce

  1. set editor mode to vi
  2. press v to visual selection

Seems that crate::core_editor::Editor should be aware of current edit mode in order to fix this issue.

fdncred commented 1 month ago

seems like a reasonable request. i also wish the coloring was maybe just the reverse of whatever the text is. it's so hard to see, but that's a separate issue.

blindFS commented 1 month ago

seems like a reasonable request. i also wish the coloring was maybe just the reverse of whatever the text is. it's so hard to see, but that's a separate issue.

Yes, there's exposed API with_visual_selection_style in engine.rs but never get called in nushell. Reversed color is a cooler idea.

fdncred commented 1 month ago

https://github.com/nushell/nushell/pull/14052