mastodon-alt icon indicating copy to clipboard operation
mastodon-alt copied to clipboard

Display of toots with line break

Open bmp opened this issue 2 years ago • 17 comments

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

bmp avatar Feb 02 '23 07:02 bmp

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.

rougier avatar Feb 02 '23 13:02 rougier

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

csantosb avatar Jul 18 '23 12:07 csantosb

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

rougier avatar Jul 19 '23 10:07 rougier

Yes, it does for me.

csantosb avatar Jul 19 '23 11:07 csantosb

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

bmp avatar Jul 19 '23 14:07 bmp

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)

rougier avatar Aug 24 '23 08:08 rougier

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.

deen1 avatar Jan 04 '24 08:01 deen1

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.

rougier avatar Jan 09 '24 21:01 rougier

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.

deen1 avatar Jan 10 '24 16:01 deen1

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.

bmp avatar Jan 17 '24 11:01 bmp

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

rougier avatar Jan 22 '24 10:01 rougier

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.

deen1 avatar Jan 22 '24 18:01 deen1

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

rougier avatar Feb 05 '24 14:02 rougier

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.

deen1 avatar Feb 06 '24 16:02 deen1

Exactly. Care to make a PR?

rougier avatar Feb 19 '24 10:02 rougier

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

deen1 avatar Feb 24 '24 16:02 deen1

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

LuciusChen avatar Apr 03 '24 06:04 LuciusChen