Open Disc0Smurf opened 6 years ago
I just realised this doesn't actually add tabs to the val
variable, it just adds the text
...
can you add steps to reproduce/demo?
I put together a small fiddle
Makes sense. I think it's better to replace with
. Width of four
can be little bit different from width of \t
. Non-breaking spaces should work OK. Can you introduce PR for this fix? (src directory only is ok).
Just make sure it works, and I'll compile and publish it everywhere.
Thanks!
Geez man, I don't know how that'll work. In my case, I'm using a monospace font and tab-size as number (of chars). So I just wrote a function:
var tab = "";
for(i=0;i<parseInt($el.css("tab-size"));i++) tab+="X";
value=value.replace(/\t/g,tab);
I honestly have no idea how to make this compatible with other ways of tab-size
. No offense but I'm not really looking for a PR.
If you do however find a fix, please let me know! And best of luck!
I'm not an expert on this kind of stuff, so it could be I missed it, but the 'full sized' js file (not the .min.js file) doesn't take tabs into a count. I had a big html file open and noticed the width didn't match and that's when I found out that the shadow element doesn't have the tabs from the original textarea value. For it worked when I added
.replace(/\t/g,' ')
on theupdate
function after theval = _this.value.replace(....
. This is not the cleanest way to fix it though.