Closed (won't fix)
Project:
MaxLength
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Aug 2012 at 05:22 UTC
Updated:
26 Aug 2021 at 18:41 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
leksat commentedI made some research on the topic. And, yes, there is a problem with line breaks because they are browser/OS depended. The JavaScript code tries to solve the issue, but all it did - it counts all line breaks ("\r\n", "\r", or "\n") as two symbols.
We don't actually care about how many characters will be stored in the database. So, my suggestion is to count all type of line breaks as one character on both PHP and JavaScript sides. That will be more user friendly.
If this is sufficient, I will create a patch.
Comment #2
rooby commentedSounds logical to me.
Comment #3
sgurlt commentedSubscribing !
Comment #4
rooby commented@sg88:
You can subscribe to issues by clicking the "Follow" button at the top right of the issue.
Comment #5
undertext commentedComment #6
brandy.brown commentedsupplied patch doesn't change anything for me.
Comment #7
juagarc4 commentedSounds logical to me too.
Supplied patch works for me.
Thanks.
Comment #8
kungfu4 commentedSo, one thing I've noticed that is related to this (patch or no patch) if you do a simple line break (shift-return), when you type another character after doing that, it is not counted. Has anyone else encountered this?
Thanks
Comment #9
tmcfarlin4 commentedComment #10
tmcfarlin4 commented#9 is quick and dirty, someone can clean it up, but this addresses #8 & seems to be more robust.
Comment #11
tmcfarlin4 commentedComment #12
tim@lammar.be commentedI fixed it by forcing to count each format of line ending as 2 characters (as the browser forces the POST data to use \r\n).
Next I force stop an enter press if the remaining character count < 2 (otherwise the remaining will be -1).
Comment #13
woutervu commentedI think it can be argued whether or not a negative remaining character counter or force stopping an enter press are welcome features. However I do agree with @Leksat that line breaks should be counted as one character. As to not further pollute this issue, I've created a seperate issue with a patch included: https://www.drupal.org/project/maxlength/issues/3043450#comment-13040630
Comment #14
cedeweyWe are only maintaining the Drupal 7 version of the module for critical security fixes, so I'm marking this Closed (works as designed). Thank you everyone for working on this issue. If you do want to maintain the Drupal 7 version, do reach out. We'd be happy to bring you on board as a maintainer.
I also encourage you, if you haven't already, to upgrade your site to Drupal 8/9. We are actively maintaining that version and you would enjoy all of the other features of the latest version of Drupal.