Skip to content
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

Dimming inside string functions doesn't work #3091

Closed
taitox opened this issue May 13, 2024 · 1 comment
Closed

Dimming inside string functions doesn't work #3091

taitox opened this issue May 13, 2024 · 1 comment
Labels

Comments

@taitox
Copy link

taitox commented May 13, 2024

Steps to reproduce the problem

If using $cut(<%year%>,4), the currently highlighted track shows the 4 first characters of %year%, but any non-highlighted track returns "[001B]1;-".
If using <$cut(%year%,4)>, everything works correctly.
The same happens when using $left.

Example of an unusable output

What's going on? Describe the problem in as much detail as possible.

Beforehand, I am aware that we shouldn't expect everything to work yet when using title formatting.

The extreme example cited above happens when using $cut and $len. Most other functions give me no trouble, such as $if(%isplaying%,%length%,<%length%>) which is always displayed correctly in any situation.
A similar but less annoying behavior happens when using other string functions, such as $num(<%year%>,6), which outputs text without dimming. However, <$num(%year%,6)> does give me dimming. Same when using $directory. So I presume this only applies to string functions, hence the title, but the only one that gave me a completely unusable output until now was $left/$cut..

This worked in either way in foobar2000, so I initially tried the first option by copypasting f2k's formatting until I found a solution.

Information about the software:

Deadbeef version: 1.9.6-1, installed from AUR
OS: Linux, kernel 6.8.8-arch1-1

@taitox taitox changed the title Dimming inside string functions doesn't work as intended Dimming inside string functions doesn't work May 13, 2024
@Oleksiy-Yakovenko
Copy link
Member

Oleksiy-Yakovenko commented Jun 25, 2024

I have made a fix, which ignores escape sequences when counting characters in the $cut function.
There are some possible side-effects from that, since the input data is ambiguous when the input string is more complex.
For example $cut(<%year%><xxyy>,4) will output <1234>< because it would continue scanning until it encounters a non-escape character.

I don't know how problematic this is, and I can't see how to resolve such cases unambiguously.
Any input is appreciated.

If this fix is well accepted / not causing much issues -- I'll add a similar fix to other substring-related functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants