Fix bug where endcode is not inserted when it starts with a newline.
Fix bug where endcode is not inserted when it starts with a newline.

abinashk-inf/AstroBox,Voxel8/OctoPrint,beeverycreative/BEEweb,bicephale/OctoPrint,shohei/Octoprint,ryanneufeld/OctoPrint,mrbeam/OctoPrint,chriskoz/OctoPrint,ryanneufeld/OctoPrint,C-o-r-E/OctoPrint,MaxOLydian/OctoPrint,DanLipsitt/OctoPrint,3dprintcanalhouse/octoprint2,ymilord/OctoPrint-MrBeam,hudbrog/OctoPrint,masterhou/OctoPrint,nicanor-romero/OctoPrint,beeverycreative/BEEweb,ErikDeBruijn/OctoPrint,3dprintcanalhouse/octoprint1,Salandora/OctoPrint,CapnBry/OctoPrint,Salandora/OctoPrint,shohei/Octoprint,dansantee/OctoPrint,foosel/OctoPrint,alex1818/OctoPrint,alephobjects/Cura,alex1818/OctoPrint,skieast/OctoPrint,leductan-nguyen/RaionPi,EZ3-India/EZ-Remote,Jaesin/OctoPrint,senttech/OctoPrint,Mikk36/OctoPrint,beeverycreative/BEEweb,mrbeam/OctoPrint,javivi001/OctoPrint,mcanes/OctoPrint,foosel/OctoPrint,AstroPrint/AstroBox,eddieparker/OctoPrint,shaggythesheep/OctoPrint,MoonshineSG/OctoPrint,dansantee/OctoPrint,CapnBry/OctoPrint,abinashk-inf/AstroBox,aerickson/OctoPrint,punkkeks/OctoPrint,madhuni/AstroBox,Jaesin/OctoPrint,SeveQ/OctoPrint,Jaesin/OctoPrint,MaxOLydian/OctoPrint,eliasbakken/OctoPrint,jneves/OctoPrint,Skeen/OctoPrint,javivi001/OctoPrint,nicanor-romero/OctoPrint,sstocker46/OctoPrint,nicanor-romero/OctoPrint,nickverschoor/OctoPrint,sstocker46/OctoPrint,CapnBry/OctoPrint,nickverschoor/OctoPrint,uuv/OctoPrint,eddieparker/OctoPrint,jneves/OctoPrint,MaxOLydian/OctoPrint,hudbrog/OctoPrint,EZ3-India/EZ-Remote,uuv/OctoPrint,dansantee/OctoPrint,MoonshineSG/OctoPrint,C-o-r-E/OctoPrint,DanLipsitt/OctoPrint,senttech/OctoPrint,aerickson/OctoPrint,mayoff/OctoPrint,ErikDeBruijn/OctoPrint,markwal/OctoPrint,Javierma/OctoPrint-TFG,chriskoz/OctoPrint,leductan-nguyen/RaionPi,rurkowce/octoprint-fork,mcanes/OctoPrint,senttech/OctoPrint,shaggythesheep/OctoPrint,d42/octoprint-fork,MoonshineSG/OctoPrint,Catrodigious/OctoPrint-TAM,Skeen/OctoPrint,d42/octoprint-fork,beeverycreative/BEEweb,Catrodigious/OctoPrint-TAM,skieast/OctoPrint,punkkeks/OctoPrint,uuv/OctoPrint,mcanes/OctoPrint,bicephale/OctoPrint,leductan-nguyen/RaionPi,rurkowce/octoprint-fork,JackGavin13/octoprint-test-not-finished,EZ3-India/EZ-Remote,nickverschoor/OctoPrint,Skeen/OctoPrint,Javierma/OctoPrint-TFG,madhuni/AstroBox,ErikDeBruijn/OctoPrint,Javierma/OctoPrint-TFG,Jaesin/OctoPrint,alephobjects/Cura,mrbeam/OctoPrint,aerickson/OctoPrint,SeveQ/OctoPrint,shohei/Octoprint,skieast/OctoPrint,Catrodigious/OctoPrint-TAM,MolarAmbiguity/OctoPrint,bicephale/OctoPrint,ymilord/OctoPrint-MrBeam,SeveQ/OctoPrint,markwal/OctoPrint,eliasbakken/OctoPrint,spapadim/OctoPrint,3dprintcanalhouse/octoprint1,AstroPrint/AstroBox,dragondgold/OctoPrint,jneves/OctoPrint,chriskoz/OctoPrint,spapadim/OctoPrint,bicephale/OctoPrint,masterhou/OctoPrint,leductan-nguyen/RaionPi,EZ3-India/EZ-Remote,CapnBry/OctoPrint,Voxel8/OctoPrint,mayoff/OctoPrint,ryanneufeld/OctoPrint,MolarAmbiguity/OctoPrint,MoonshineSG/OctoPrint,madhuni/AstroBox,shaggythesheep/OctoPrint,foosel/OctoPrint,alephobjects/Cura,MolarAmbiguity/OctoPrint,Voxel8/OctoPrint,3dprintcanalhouse/octoprint2,AstroPrint/AstroBox,spapadim/OctoPrint,Salandora/OctoPrint,ymilord/OctoPrint-MrBeam,mayoff/OctoPrint,eliasbakken/OctoPrint,shohei/Octoprint,markwal/OctoPrint,C-o-r-E/OctoPrint,masterhou/OctoPrint,dragondgold/OctoPrint,alex1818/OctoPrint,Mikk36/OctoPrint,ymilord/OctoPrint-MrBeam,abinashk-inf/AstroBox,abinashk-inf/AstroBox,Salandora/OctoPrint,punkkeks/OctoPrint,Mikk36/OctoPrint,ryanneufeld/OctoPrint,dragondgold/OctoPrint,sstocker46/OctoPrint,JackGavin13/octoprint-test-not-finished,javivi001/OctoPrint,JackGavin13/octoprint-test-not-finished,chriskoz/OctoPrint,JackGavin13/octoprint-test-not-finished,eddieparker/OctoPrint,shohei/Octoprint,senttech/OctoPrint,Javierma/OctoPrint-TFG,nickverschoor/OctoPrint,madhuni/AstroBox,ymilord/OctoPrint-MrBeam,hudbrog/OctoPrint,foosel/OctoPrint