Skip to main content
Topic: Double spaces entered wrong. (Read 5269 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Double spaces entered wrong.

I'm not sure if this is done by elk or sceditor but it's really annoying.  If you're old like me and were taught to type two spaces after periods then in order to preserve that a nbsp is inserted.  Yay, that's good.  But here's the problem.  On elk the nbsp is inserted as the second space and not the first one.  Why is that a problem?  Because if the word wrap happens to break there the word will be indented one space at the start of the next line which looks awful in left to right languages.

So what's responsible for putting in the nbsp so it can be fixed to put the normal space as the last space instead of the first for left to right languages?

Re: Double spaces entered wrong.

Reply #1
Ok, now I'm even more confused.  Sometimes it stores puts the nbsp first and other times second.  Not sure what causes the differences.

Re: Double spaces entered wrong.

Reply #2
The nbsp is "added" in parse_bbc, there is an strtr that replaces any double space with a space + nbsp.
It should be enough to change the order in the replacement here:
Code: [Select]
$message = strtr($message, array('  ' => '  ',
to:
Code: [Select]
$message = strtr($message, array('  ' => '  ',

 emanuele crosses his fingers hoping Elk will escape the stuff in code blocks, but he feels it will not.

We should find a way to show stuff in code blocks exactly as it is... :-\
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #3
Adding here because I'm tired of editing the previous message: the change is in Subs.php.
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #4
Thanks for the fix.  It's odd that it seems random whether or not it hits that line as many times the substitution is done in the correct order.  I've not noticed the pattern of why though.  I even grabbed one message that exhibited the problem, clicked quick edit then save and it magically fixed itself.

Re: Double spaces entered wrong.

Reply #5
quick  reply
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #6
full  reply
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #7
full reply  wyz
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #8
quick  edit
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #9
quick reply  to full
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #10
Here it is: start from quick reply, hit preview, and then post.
In that case the order is inverted (at least is you use the plain quick reply, not tested with the full editor).
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #11
I don't use quick reply, so I suspect it has something to do with going through preview.

Re: Double spaces entered wrong.

Reply #12
Probably then the "new reply" warning or some other error.
Bugs creator.
Features destroyer.
Template killer.

Re: Double spaces entered wrong.

Reply #13
So does the change @emanuele proposed fix the issue? 
Be safe, Be kind, Happy Programing

Re: Double spaces entered wrong.

Reply #14
I can't say for certain as I've only had it in place for a little while and am not certain the various conditions that triggered it.  But I'm certain his fix is a change that should be made.  Hopefully it's the only one.  But if not and I see it again in new posts I'll report back that there's still a problem.