Done Permit blank lines in !code

PartMan

SHAW!
is a Pre-Contributor
The current behaviour of !code is to filter out any extraneous newlines. However, the most common usage of this command is to post teams and Pokemon sets - which require double newlines to be parsed properly. As it currently is, if I paste a team to another user, it'll be displayed as

Alcremie (F) @ Leftovers
Ability: Aroma Veil
EVs: 252 HP / 252 SpA / 4 SpD Modest Nature
IVs: 0 Atk
- Decorate
- Helping Hand
- Dazzling Gleam
- Psyshock
Swoobat (M) @ Weakness Policy
Ability: Simple
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
IVs: 0 Atk
- Calm Mind
- Stored Power
- Ally Switch
- Air Slash


which requires manual editing to become importable. My suggestion is to permit consecutive newlines in code blocks, or at least permit two to be displayed.

(If this is approved, I'll PR the fix.) */

const params = str.slice(+str.startsWith('\n')).split('\n');
 
Of course! It's 100% a bug that blank lines get stripped; it must have been in one of our recent refactors to how code works.
 
5 hours of cat-and-mouse later, I got lost. The thing is:
a) This only happens in PMs - chat broadcasts work perfectly.
b) This is because of how blank lines in PMs are ignored.
c) I saw
// The PM matching is a huge mess, and really needs to be replaced with
// the new multiline command system soon.

and kinda lost all hope.
 
fwiw this has been the case in PMs since the day it got added, so looking towards recent code updates that changed something won't yield results
 
5 hours of cat-and-mouse later, I got lost. The thing is:
a) This only happens in PMs - chat broadcasts work perfectly.
b) This is because of how blank lines in PMs are ignored.
c) I saw
// The PM matching is a huge mess, and really needs to be replaced with
// the new multiline command system soon.

and kinda lost all hope.
You're barking up the wrong tree. I recommend checking the client's console for the send/receive log, which would have let you notice that blank lines were simply not being sent. ;)

https://github.com/smogon/pokemon-showdown-client/commit/d5cae3cb3b5606edd67f30c0342462208789985a
 
Back
Top