ChrisTitusTech / linutil

Chris Titus Tech's Linux Toolbox - Linutil is a distro-agnostic toolbox designed to simplify everyday Linux tasks.
https://christitus.com
MIT License
1.75k stars 158 forks source link

Add cursor to the search input #176

Closed SoapyDev closed 1 week ago

SoapyDev commented 3 weeks ago

Also add navigation related to the cursor

Pull Request

Title

Add a cursor to the search bar

Type of Change

Description

Add a cursor to the search bar when in focus. Also allow the user to move forward, backward and to insert and delete on position.

Testing

Manual testing

Impact

Improve usability for end user.

Additional Information

https://github.com/user-attachments/assets/f105df19-55fe-403b-a4ba-805f2ba75a55

Checklist

lj3954 commented 3 weeks ago

Strings are UTF-8 encoded, and thus characters can differ in the amount of length they take up in the string (string length is measured in bytes, not human readable characters). Try inputting one special character which takes up more than 1 byte, then another character of any type. The program will immediately panic. That, in addition to the fact that you're using these iterators to remove singular characters, shows that Vec<char> would be a much better choice.

Take a look at https://github.com/lj3954/linutil/tree/pr_176, I've added 2 commits that would probably be helpful.

SoapyDev commented 3 weeks ago

Thanks for the fix!

Will happily wait for the merge of #177