Page MenuHomePhabricator

jquery.byteLimit rewrite sometimes removes the last character instead of the most recently added, even if it could know this
Closed, ResolvedPublic

Description

To reproduce make sure your wiki is up to date, load jquery.byteLimit, create an input with a limit of 6 bytes and do the following steps.

  1. Enter "äöü", move the cursor to the start.
  2. Type "ß"

Expected result: Nothing, "äöü" are 6 bytes.
Actual result: Text changes to "ßäö".
Possible solution: Always update the last value, not only if it has been trimmed.


Version: 1.21.x
Severity: major

Details

Reference
bz40850

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:05 AM
bzimport set Reference to bz40850.
bzimport added a subscriber: Unknown Object (MLST).

I'm also experiencing this problem and it is really annoying.

  • When I paste something which makes the total length to exceed the limit, the script remove part of what is at the end of the string (instead of part of what I'm pasting or of not pasting at all) and focus at the last character
  • Then I have to go back to the middle of the string to find where is the text I was trying to change, and undo my changes (since they won't be accepted because of the limit);
  • Then also go back to the end of the string to manually restore the original string (this is particularly important when the end of the string is a "[[link]]", which would break without closing "]]"), without being able to use CTRL+Z to undo the mess made by the script.

Fix submitted as gerrit change 33556.