lionleaf / dwitter

Social network for short js demos
https://www.dwitter.net
Apache License 2.0
771 stars 67 forks source link

Initial character count is off #462

Closed jrsmb closed 4 years ago

jrsmb commented 4 years ago

Description

The site now, since 2019-12-27, uses a new counting system that fixed counting errors with compressed dweets. Seems to work fine but this is another counting error I found. A dweet shows up with a character count that is wrong. If you delete a character and type one again, the count is different than before. In the dweet that I found the count is 143 before and 139 after a quick edit. See attachments.

Reproduction

I don't know for how long it will be possible: Right now you can go to the home page https://www.dwitter.net, scroll down to load more and maybe the tenth dweet is by LimeLight. If you reached it by scrolling down, the bug should be visible. If you go to the individual dweet share page, it's not there. More dweets will have this problem but they are hard to find

Comment by lionleaf

Pretty sure this is the counting line that disagrees with the javascript counting (and with the database, or else it couldn't have been posted): https://github.com/lionleaf/dwitter/blob/master/dwitter/templates/snippets/dweet_card.html#L95


lionleaf commented 4 years ago

Mentioned by @kipkat and @KilledByAPixel in discord, this might be cause by counting newline as two characters (\n\r). Will investigate.