Is there any way this can be modified/configured to omit spaces from the count?


Members fund testing for the Drupal project. Drupal Association Learn more


dakala’s picture

Assigned: Unassigned » dakala
4.66 KB

First attempt at getting this feature added. Thanks.

matt.rad’s picture

4.1 KB

Thanks very much!

It took me a while to get organised, as I have not applied any patches before.

Unfortunately, I got the following errors:

hunks failed

dakala’s picture

@matt.rad: Most likely it wasbeing applied against a different branch. It was generated from the 7.x-3.x branch. Let me know if there's anything else I can help with.

matt.rad’s picture

4.09 KB

Hi dakala,

Thanks for replying.

I had tried this with both the 7.x-3.x-beta version and the 7.x-3.x-dev version. I tried again and now I am getting a different error saying that it can't find the file to patch at input line 5, then in prints the first 4 lines of the patch.

I have placed the patch in the correct place as described in the patch (i.e. maxlength/js) and have followed the instructions here: https://drupal.org/node/620014

I also read that using a higher n with -pn can work. I found that Hunk #5 succeeds with -p2, but all of this makes little sense to me. I hope you can help.

failed to find file to patch

matt.rad’s picture

Sorry, is this something to do with the patch being for both the .module file and the .js file and those being in different places within the directory structure? Should the automatically be compensated for somehow by the patch itself?

dakala’s picture

I suppose you've checked out the 7.x-3.x branch. Copy the file to the module directory and run:

patch -p1 < PATCH_FILE_NAME.patch

The js/maxlength.js in the diff is for the patch program to locate the file to work on. You don't need to worry about that

dakala’s picture

I've just cloned a fresh copy of 7.x-3.x branch from git and applied the same patch successfully, so it should work for you too. If you're on Windows and you've got Winmerge, I can attached a zip file of the patched module so you can try a visual merge.

matt.rad’s picture

2.94 KB

Thanks very much! I have made some headway here. (Sorry for thinking out loud, but it might be helpful for someone else in the dark.)

By running the patch in the module folder with the command
patch -p1 < PATCH NAME.patch
as you suggested on the 7.x-3.x version I was able to get it down to 1 out of 4 hunks failing.

1 of 4 failed

Applied the dev module, the patch worked successfully.

And I can report that the patch works great, but I think that it is not counting spaces regardless of whether or not I check the box to exclude spaces.

You have been very helpful.

dakala’s picture

If the flag doesn't work then it's probably a check in the code that's buggy. I'll look into that.

dakala’s picture

@matt.rad: Fixed bug in the code and re-rolled the patch.

matt.rad’s picture

Status: Active » Closed (fixed)

Beautiful. Works like a charm!

antiorario’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Don't mark an issue as fixed if the patch hasn't been committed, otherwise it never will be.