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

pasted text in can cause it to go over the max length #41

Closed
drewB opened this issue Dec 19, 2013 · 8 comments · Fixed by #50
Closed

pasted text in can cause it to go over the max length #41

drewB opened this issue Dec 19, 2013 · 8 comments · Fixed by #50

Comments

@drewB
Copy link

drewB commented Dec 19, 2013

We have noticed that sometimes when you paste text into the the text area it will go over the length by a few characters. It will show for example "603 of 600" and if you delete the 3 characters it will again enforce the limit. While we have not been able to reproduce it consistently it has been experienced by several people on our team.

@drewB
Copy link
Author

drewB commented Dec 19, 2013

we are using v1.4.2. Didn't look like anything in the change log would suggest this was fixed in v1.5.0

@mimo84
Copy link
Owner

mimo84 commented Dec 19, 2013

ok, can you please try updating first and then create a fiddle to show the
issue?

2013/12/19 Drew Batshaw notifications@github.com

we are using v1.4.2. Didn't look like anything in the change log would
suggest this was fixed in v1.5.0


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-30900215
.

@mimo84 mimo84 closed this as completed Dec 19, 2013
@drewB
Copy link
Author

drewB commented Dec 23, 2013

BTW, looks like I was using that latest version but the comment at the top on master still says v1.4.2

@drewB
Copy link
Author

drewB commented Dec 23, 2013

Here is a fiddle that reproduces it http://jsfiddle.net/Tr2nU/2/.

On Chrome, I consistently see 603/600 when I do it. Just follow the instructions.

@mimo84 mimo84 reopened this Dec 23, 2013
@drewB
Copy link
Author

drewB commented Dec 24, 2013

I appears to me to be some how related to multiple new lines in the text (rather than being directly related to copy and paste).

@pocketarc
Copy link
Contributor

@drewB Newlines count as two characters with this plugin, but only 1 character by the browser, hence the inconsistencies. If your text has 10 lines, the browser will still cut off pasting after 600 characters, but bootstrap-maxlegnth will say it's 610 characters because it'll count the 10 lines twice.

I've just come across this myself. I might spend some time on this and create a pull request to fix this, unless @mimo84 thinks that 2 characters per line is the intended behavior.

@mimo84
Copy link
Owner

mimo84 commented Mar 10, 2014

The reason of this odd behaviour is because of #4 but on #38 have been added the IgnoreBreaks flag, which is not yet documented but that should fix your issue (I haven't tested it).
I guess the best behaviour is that this flag is removed as well as the the double counter.

pocketarc added a commit to pocketarc/bootstrap-maxlength that referenced this issue Mar 18, 2014
pocketarc added a commit to pocketarc/bootstrap-maxlength that referenced this issue Mar 18, 2014
@pocketarc
Copy link
Contributor

I've created a Qunit test for this bug and fixed it in my fork. I've also removed the IgnoreBreaks flag, as you mentioned. I'll create a pull request now.

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 a pull request may close this issue.

3 participants