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

Preserve linefeeds #81

Closed
wants to merge 1 commit into from
Closed

Preserve linefeeds #81

wants to merge 1 commit into from

Conversation

kseistrup
Copy link

Replace '\n' with a br/ HTML tag.

Replace '\n' with '<br/>'.
@kseistrup
Copy link
Author

While this is currently not very useful in the web client, someone using a commandline client may be able to excert greater control over the message format.

@toyg
Copy link
Collaborator

toyg commented Jan 27, 2014

This looks sensible. Paging @miguelfreitas to accept.

@kseistrup
Copy link
Author

The patch works as such. However, I believe it exposes a fault in the way links are detected and hightlighted.

See, if I send the string "A\nB\nC\n\nX\n\nY" it is correctly showed as

A
B
C

X

Y

on the postboard. BUT if I send the string `"A\nB\nC\n\nhttp://www.google.com/\n\n:-)" I will see

A
B
C

http://www.google.com/<b/><b/>:-)

on the postboard instead of

A
B
C

http://www.google.com/

:-)

I haven't had the time to look into this.

@kseistrup
Copy link
Author

Another things is: The "\n" thing, is it specifik to Linux? Do they use the same thing under Windows and MacOS? Or will we have to something like

  msg = msg.replace(/\r\n/g, '<br/>');
  msg = msg.replace(/\r/g, '<br/>');
  msg = msg.replace(/\n/g, '<br/>');

in order to cover all possible cases?

@miguelfreitas
Copy link
Owner

I'd rather have this as an option. I know Twitter started accepting linefeeds last year or so, but they have other means of filtering messages we don't. What if people start posting 140 line feeds in a message? the timeline won't look pretty and we won't be able to do anything about it.

IMHO this belong to config page, as much as: (1) showing messages which start with @someoneelse (2) following somebody just to process DMs, not to show on timeline, etc.

@toyg
Copy link
Collaborator

toyg commented Jan 28, 2014

For the record, the actual regex to use is /(\r\n|\n|\r)/gm.

@kseistrup
Copy link
Author

@miguelfreitas, a user posting 140 linefeeds time and again would soon see himself without any followers. Problem solved.

@miguelfreitas
Copy link
Owner

hmmm... what about a promoted message with 140 line feeds? :)

@kseistrup
Copy link
Author

@miguelfreitas, if someone wants to waste CPU cycles on having the chance to send out a few twists with 140 linefeeds, so be it — I rarely see a promoted message (wild guess: once a week).

@rbertoche
Copy link
Collaborator

We could just have some hard-coded line limit, as we have for chars. Five or ten would suffice, I think
Personally I hate to write "-" or some random separator when I don't want a period. It's just me?

@miguelfreitas
Copy link
Owner

I like the idea of limiting the number of linefeeds.

@kseistrup
Copy link
Author

Limiting the numer of linefeeds could be a good compromise.

@miguelfreitas
Copy link
Owner

obsolete

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.

4 participants