contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.32k stars 101 forks source link

Case-insensitive search and configurable default search mode #1410

Open 0x5c opened 5 months ago

0x5c commented 5 months ago

Abstract

Implement a case-insensitive search, a config key to select the default search case-sensitivity, and a way to change the case-sensitivity while in the search mode.

As a bonus, a "smart-case" search (case-insensitive if the input is lowercase, case-sensitive if the input has an uppercase character) would be useful too.

Motivation

Contour is currently only able to do a case-sensitive search, which makes it significantly harder to find things where the case is not known.

Specification

I'm not sure about the details, if it should be a keybind action that changes the case-sensitivity, or a special sequence like the way vim does it (\c anywhere in the search string). This should probably require an indicator in the status bar.

It seems clear to me is that it should be switchable once already in the search mode, and not only be a separate keybind action that starts a -separate- case-insensitive search mode. It might still be useful to have a case-sensitive: true/false option on the SearchReverse action for people that want to have that, but it isn't my use-case.

christianparpart commented 5 months ago

This sounds like a great idea, that goes along with my own pain of wanting to have that (from time to time) as well as regex search. Sorry for not having implemented it yet, but we'll make it happen and keep you posted here :-)

Yaraslaut commented 5 months ago

So we need to have:

0x5c commented 4 months ago

action to trigger search in case-insensitive mode

Might be better to be able to set a default directly, and have a param on the keybind action to override the default

Yaraslaut commented 2 days ago

I realized that emacs evil-mode has a very good default behavior when it comes to search, by default if you are using all lower-case letters search is case-insesnsitive, but if you have at least one upper letter search becomes case-sensitive

0x5c commented 2 days ago

I realized that emacs evil-mode has a very good default behavior when it comes to search, by default if you are using all lower-case letters search is case-insesnsitive, but if you have at least one upper letter search becomes case-sensitive

Yeah it's part of the request, it's what vim calls "smart case"