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

fix #454 overflowing of song title #529

Merged
merged 43 commits into from
Aug 4, 2024

Conversation

DOD-101
Copy link
Contributor

@DOD-101 DOD-101 commented Jul 31, 2024

This PR needs to be merged after #482 resolved

Fix #454 by splitting the metadata text and the "title" text into two
different rects. This means that the title text being cut off to long
won't cause the metadata text to overflow outside the viewport.

This does however mean that the playback_format config option should
no longer contain the {metadata} placeholder.

DOD-101 and others added 27 commits June 29, 2024 19:40
It is now possible to adjust the width of the three sections in the
library view.
Added a check to make sure that album_width + playlist_width isn't too
large.
Change code back to simply error instead of catching the error and
setting defaults.
* Use BufReader/BufWriter for data from file cache

* formatting

---------

Co-authored-by: user <puh@p>
Co-authored-by: Thang Pham <phamducthang1234@gmail.com>
There is now a section which will contain all of the layout config
options.
Add a section detailing the configuration for the layout options.
Clean up of code and removal of clippy errors
Fix aome510#454 by splitting the metadata text and the "title" text into two
different rects. This means that the title text being cut off to long
won't cause the metadata text to overflow outside the viewport.

This does however mean that the `playback_format` config option should
no longer contain the `{metadata}` placeholder.

BREAKING CHANGE: removed `{metadata}` from `playback_format`
@aome510
Copy link
Owner

aome510 commented Aug 1, 2024

This PR needs to be merged after #482

Why is this the case? I thought you can create an upstream PR from a branch in your fork. Separate two PRs gonna make reviewing easier unless two PRs are strictly dependent

DOD-101 added 2 commits August 1, 2024 09:21
Remove old config options, which should previously already have been
removed.
@DOD-101 DOD-101 changed the title fix #454 fix #454 overflowing of song title Aug 1, 2024
DOD-101 and others added 2 commits August 2, 2024 10:29
Remove text that accidentally showed up when resolving merge conflicts on
github.
@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

I thought the overflow can be fixed by increasing playback_window_width. I don't see why we need a separate title_height?

@apprehensions
Copy link
Contributor

The title should simply be truncated if it can't fit fully. The official spotify client 'wraps' the title by moving it from left to right, but i don't believe that will be possible here.

@apprehensions
Copy link
Contributor

Could you squash your commits?

@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

The title should simply be truncated if it can't fit fully. The official spotify client 'wraps' the title by moving it from left to right, but i don't believe that will be possible here.

truncating can be done by disabling wrapping when rendering the playback info.

let playback_desc = Paragraph::new(playback_text).wrap(Wrap { trim: false });

@DOD-101
Copy link
Contributor Author

DOD-101 commented Aug 4, 2024

truncating can be done by disabling wrapping when rendering the playback info.

Yes, however this would mean also cutting off the metadata info and what's if some people would rather have the text wrap so they can actually read it.

I thought the overflow can be fixed by increasing playback_window_width. I don't see why we need a separate title_height?

The problem with this is that some people have their metadata at the bottom of the playback window. When the text now wraps the metadata disappears.

image

vs

image

Adding a separate rect for the metadata would fix this. It would mean that the title / album / artist wrapping wouldn't affect the position of the metadata.

The title should simply be truncated if it can't fit fully.

This can be done by simply setting title_height to 1 (which is the default).

@DOD-101
Copy link
Contributor Author

DOD-101 commented Aug 4, 2024

Could you squash your commits?

Yes, but why?

Since the commits get squashed when merged into main it makes seems to me there is no difference once the PR is merged.

Why would you like me to squash them?

@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

The problem with this is that some people have their metadata at the bottom of the playback window. When the text now wraps the metadata disappears.

I don't see how this can happen. The whole playback info is constructed as a single paragraph widget. Wrapping in one line shouldn't affect others. See the below picture, title line is wrapped but it doesn't affect other lines.

image

@apprehensions' problem in the original issue happened because of the wrapping as he used spaces to represent paddings between playback section and cover image section, which doesn't work with text wrap. My suggestion is just simply disabling wrapping, then no overflowing issue will happen.

However, I can see that text wrapping can be convenient feature for some people.

@DOD-101
Copy link
Contributor Author

DOD-101 commented Aug 4, 2024

Wrapping in one line shouldn't affect others.

I'm not entirely sure what you mean by "affect", but what happens to me is that when the title line wraps it now takes up two lines, which means the line for the metadata is now no longer visible, because it is pushed down a line.

Here is my config for reference:

playback_format = """
{track} • {album} • {artists}



{metadata}"""
playback_window_height = 6

@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

Wrapping in one line shouldn't affect others.

I'm not entirely sure what you mean by "affect", but what happens to me is that when the title line wraps it now takes up two lines, which means the line for the metadata is now no longer visible, because it is pushed down a line.

Here is my config for reference:

playback_format = """
{track} • {album} • {artists}



{metadata}"""
playback_window_height = 6

Can you try replacing whitespace with newline (\n)? Maybe whitespace doesn’t work well with text wrapping

@DOD-101
Copy link
Contributor Author

DOD-101 commented Aug 4, 2024

Can you try replacing whitespace with newline (\n)? Maybe whitespace doesn’t work well with text wrapping

Same thing happens.

This is the new config.

playback_format = """{track} • {album} • {artists}\n\n\n\n{metadata}"""

@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

Can you try replacing whitespace with newline (\n)? Maybe whitespace doesn’t work well with text wrapping

Same thing happens.

This is the new config.

playback_format = """{track} • {album} • {artists}\n\n\n\n{metadata}"""

Ah I see, it's because you add extra lines to push the metadata to the end. Therefore, it's expected for the metadata part to be moved outside the view upon overflowing.

@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

Let's disable wrapping then. It's much simpler and will also resolve your problem.

@DOD-101
Copy link
Contributor Author

DOD-101 commented Aug 4, 2024

Ah I see, it's because you add extra lines to push the metadata to the end.

Yup.

Let's disable wrapping then. It's much simpler and will also resolve your problem.

I can implement this if you like, but since we can achieve the same with setting the title_height to 1 as a default and give people the option to adjust it using the option. (Effectively toggling wrapping) It is the option I prefer / suggest.

@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

I don't like separating metadata and other sections because it adds extra complexity while being less flexible, e.g. what if user wants to render metadata before album, artist?

@DOD-101
Copy link
Contributor Author

DOD-101 commented Aug 4, 2024

Fair point. I'll go ahead and change the code to turn off wrapping.

@apprehensions
Copy link
Contributor

20240805_001516
While the title and album look like theyre simply truncated, there is no visual indicator such as ..., additionally, the album cover is missing.

@aome510
Copy link
Owner

aome510 commented Aug 4, 2024

20240805_001516 While the title and album look like theyre simply truncated, there is no visual indicator such as ..., additionally, the album cover is missing.

probably because it failed to save the image file when album's name is too long

@aome510 aome510 merged commit bd96127 into aome510:master Aug 4, 2024
3 checks passed
@DOD-101 DOD-101 deleted the fix-454-2024-07-28 branch August 5, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Title overflows when too long
5 participants