boysetsfrog / vimpc

Official repository for vimpc a vi/vim inspired client for the Music Player Daemon (mpd). Pull requests are welcome.
GNU General Public License v3.0
269 stars 34 forks source link

Character alignment? #6

Open connermcd opened 12 years ago

connermcd commented 12 years ago

I love the new custom format options! I do feel like it's lacking some alignment though. It would be great if you could specify a character to align on so that this:

  [    6] José González - Veneer - Deadweight on Velveteen                                    [ 3:27]
  [    7] Erroll Garner - Solitaire - Talk of the Town                                        [ 6:03]
  [    8] Sufjan Stevens - The Avalanche - The Pick-Up                                        [ 3:24]
  [    9] Coldplay - Parachutes - Everything's Not Lost / Life Is for Living                  [ 7:14]
  [   10] Laura Veirs - Troubled by the Fire - Song My Friends Taught Me                      [ 4:32]

would look like this:

  [    6] José González  - Veneer               - Deadweight on Velveteen                     [ 3:27]
  [    7] Erroll Garner  - Solitaire            - Talk of the Town                            [ 6:03]
  [    8] Sufjan Stevens - The Avalanche        - The Pick-Up                                 [ 3:24]
  [    9] Coldplay       - Parachutes           - Everything's Not Lost / Life Is for Living  [ 7:14]
  [   10] Laura Veirs    - Troubled by the Fire - Song My Friends Taught Me                   [ 4:32]

if I set my alignment string to / - / (notice the spaces so The Pick-Up doesn't get aligned). Would be a great enhancement!

boysetsfrog commented 12 years ago

I think something like this is a good idea. I think I would prefer to incorporate it into the format string directly though, but I will see what I can do. Thanks for the suggestions!

ahti commented 10 years ago

This could be solved similar to how multi-line equations can be aligned in LaTeX, where one may insert a & to mark a place that should be aligned with the corresponding ampersand on the other lines.

ahti commented 10 years ago

To elaborate a bit, I think specifying an alignment string is a) limiting the possibilities for layout (imagine just aligning things with just a space in between) and b) prone to errors (" - " seems like it could be a common divider, but also occurs in song titles).

mox-mox commented 7 years ago

Wheee, I was just searching for some functionality like this. I really like the approach of having some sort of explicit marker in the songformat string, that says what should be aligned. But I would also suggest a slightly different approach: Have a marker that says: Up to here should fill up of the line width. Why? Two reasons:

Instead we could add two new tokens to the format string:

Pros:

Btw: I like the coding style. Not many comments, but well readable :)

mox-mox commented 7 years ago

Update: That means, only the parsing function void ScrollWindow::Print(uint32_t line) const needs an update.

mox-mox commented 7 years ago

Side note: I noticed, that using the $A to mean align really was the most intuitive "name" and since I don't really see why one would need absolute alignment, I used that name. However, really any letter can be chosen by changing 'A' to another letter in two places.

connermcd commented 7 years ago

@mox-mox Thanks! On initial testing this appears to work as stated. It fails hard when the specified percentage is <= 9 as stated in the code. Also, when the playlist only contains a few songs with short titles this approach spaces them out quite a bit, but it's definitely a useful contribution.

2017-01-29-081555_1098x673_scrot

mox-mox commented 7 years ago