-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow separate styles for cursor in normal and preview panes, simplify tagfmt
and errorfmt
#1086
Conversation
9c883e8
to
ac8b1fd
Compare
tagfmt
and errorfmt
tagfmt
and errorfmt
This defines new `cursorfmt` and `crusorpreviewfmt` options to style cursor in normal/preview panes. This allows using a different style for the normal and preview cursor. The documentation includes several possible values these options can be set to. The default behavior is an underline, same as in gokcehan#1072, since it should not cause severe problems and be visible on all terminals. It can now be easily changed, as explained in the docs. I also added an example to `etc/lfrc.example`. See linked issues and PRs for the more context. Fixes gokcehan#1038 Follows up on: gokcehan#1072 gokcehan#924 gokcehan@b47cf6d5a5
This simplifies the configuration of `cursorfmt`, `cursorpreviewfmt`, `tagfmt`, and `errorfmt` options. In almost all usecases, the value of these options had to end with `%s\033[0m` to print the contents of filename/tag/error and reset the terminal style. Now, if `%s` is not part of the option's value, `%s\033[0m` is appended automatically. This simplifies configuration. I retained the same behavior as before when `%s` is part of the string for backwards compatibility. I think it should be considered deprecated, but it also causes no harm.
Thanks for working on this! Could you maybe change the name of the feature though? Calling the highlight a cursor is a bit confusing. |
A "cursor" is the best name I could think of, and it makes a lot of sense to me. I think of each dir having a cursor in it, one of which is active. I could rename When I hear "highlight", I think of highlighting text (tag highlight, "select" highlight, yank highlight, mark highlight, ...). So, something like I don't have a very strong opinion here. I guess I'm not convinced my version is particularly confusing, at least among the options I can think of, but if people have better suggestions, please share them! I also looked into what different parts of It's called a cursor, for example, in 84cf8e1. In |
Then it might be better to invent a new term (target, selector, ...) than to use something that might be confusing. A cursor in a terminal used to insert text. |
This follows up on gokcehan#1086. The option defaults to the same value as `cursorfmt`, so the default look of `lf` is unchanged. However, I find it useful to make it different, since I seem to have so much trouble figuring out which of my cursors is the active one. :)
|
On second thought, Also, do I understand correctly that the problem with "cursor" is that it can be mixed up with the cursor in the command line (after pressing Finally, another thought is "current position", shortened to "curpos" in option names. It's quite awkward, but might be workable, I'm not sure. |
In #1234, @joelim-work had the idea of using |
This PR contains two commits. The first one introduces the new feature. The second one simplifies the configuration of both the new and existing features.
New feature: Allow separeate styles for cursor in normal and preview panes
This defines new
cursorfmt
andcrusorpreviewfmt
options to style cursor in normal/preview panes, as discussed in #1038 (comment). (I renamed the options so that they sort next to each other). This allows using a different style for the normal and preview cursor. The documentation includes several possible values these options can be set to.The default behavior is an inverted normal cursor (as before) and an underline in preview, same as in
#1072. The underline should not cause severe
problems and be visible on all terminals. It can now be easily changed, as explained in the docs. I also added an example to
etc/lfrc.example
.I don't expect many people to change the normal cursor style, but some may want some fancy color and it's simpler to have both settings for consistency. For another example, a bigger fan of underlines than myself might make their normal cursor an underline and have no preview cursor at all.
See linked issues and PRs for the more context.
Fixes #1038
Fixes #1102
Follows up on:
#1072
#924
b47cf6d5a5
Simplification commit
This simplifies the configuration of
cursorfmt
,cursorpreviewfmt
,tagfmt
,and
errorfmt
options.In almost all usecases, the value of these options had to end with
%s\033[0m
to print the contents of filename/tag/error and reset the terminal style. Now,
if
%s
is not part of the option's value,%s\033[0m
is appendedautomatically. This simplifies configuration.
I retained the same behavior as before when
%s
is part of the string forbackwards compatibility. I think it should be considered deprecated, but
preserving it causes no harm.