rougier / mastodon-alt

Emacs alternative mastodon layout
GNU General Public License v3.0
46 stars 10 forks source link

Display of toots with line break #10

Open bmp opened 1 year ago

bmp commented 1 year ago

Line breaks seem to be removed sometimes, an example of this is visible with toots that have the Wordle diagram/attempts.

Here are the links to the two toots,

  1. https://mastodon.sdf.org/@bgrinter/109793890607383962
  2. https://mastodon.sdf.org/@Luke/109793887642308391

On Mastodon web, Wordle_mastodon-web

On mastodon-alt, Wordle_mastodon-alt

rougier commented 1 year ago

The reason is because I refill every toot by default. Obviously in this case it'll give a bad output. Maybe we could have a refill option. And if you ask, the reason for the refill is to be able to add box around retoot. Else, very long lines are weird. Maybe I can also have my own refill function only for this case.

csantosb commented 1 year ago

Same here. I had to change 2 to 5, for some reason, in this line

https://github.com/rougier/mastodon-alt/blob/ca70d48a3a384ee8a39ade05607a587b38ba36bc/mastodon-alt.el#L526

rougier commented 1 year ago

@csantosb But this does not fix the alignment issue, does it?

csantosb commented 1 year ago

Yes, it does for me.

bmp commented 1 year ago

The alignment issue is not fixed but the status line is displayed in a single line when i use 6 or 5 instead of 2 as indicated in https://github.com/rougier/mastodon-alt/issues/10#issuecomment-1640168673

rougier commented 1 year ago

I think the alignment issue might be linked to the presence of a fringe on the left. I shoud align to the the right fringe (which is equal to right when no fringe I think)

deen1 commented 10 months ago

I've noticed the same issue and find that it's most annoying when the toot contains bullet-pointed/enumerated lists, which each item in the list separated by a single line-break.

@rougier you mentioned this is to do with refilling the toot body – is there not a way to parse the text before refilling and add an extra line-break where the original text had one? I.e. \n -> \n\n first, and then after refilling, long-lines are truncated by a single-line break.

rougier commented 10 months ago

I suspect Emacs has certainly a function to do that but I don't know the name. For example, visual mode might be an option but I do not know the exact algorithm. Any suggestions welcome.

deen1 commented 10 months ago

I tried a few things, but I actually find that simply replacing

(string-fill content (min (- (window-width) 2) fill-column))

with just

content

seems to fix this, with few ill effects compared to the prior situation. Of course, it persists inside boosted toots, but that seems reasonable enough for me at the moment.

bmp commented 10 months ago

I tried a few things, but I actually find that simply replacing

(string-fill content (min (- (window-width) 2) fill-column))

with just

content

seems to fix this, with few ill effects compared to the prior situation. Of course, it persists inside boosted toots, but that seems reasonable enough for me at the moment.

I can confirm the same.

rougier commented 9 months ago

What do you mean by "it persists inside boosted toots"?

deen1 commented 9 months ago

When I first tried this change, it seemed as though the lines would break through the inner bounding box of a boosted toot. However, that does not actually seem to be the case -- it was probably an artefact of some a window-split or some other change. Basically, the fix works without any problems for me.

"Nicolas P. Rougier" @.***> writes:

What do you mean by "it persists inside boosted toots"?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

rougier commented 9 months ago

So maybe an option that points on refill, no-refill or user defined function might be the easiest, what do you think?

deen1 commented 9 months ago

So maybe an option that points on refill, no-refill or user defined function might be the easiest, what do you think?

If you mean that there should be some (defvar mastodon-alt--toot-refill-p t), where we modify the code above so that we have

(if mastodon-alt--toot-refill-p
  (string-fill content (min (- (window-width) 2) fill-column))
  (content) )

then I am inclined to agree. Maybe there are still some bugs in the (content) fix that haven't cropped up for me but will crop up for others.

rougier commented 8 months ago

Exactly. Care to make a PR?

deen1 commented 8 months ago

OK, see the following (which includes a fix for the status line issue too): https://github.com/rougier/mastodon-alt/pull/23

LuciusChen commented 7 months ago

Same here. I had to change 2 to 5, for some reason, in this line

https://github.com/rougier/mastodon-alt/blob/ca70d48a3a384ee8a39ade05607a587b38ba36bc/mastodon-alt.el#L526

this does for me