diff --git a/config-debug b/config-debug index 74d28f2..1197447 100755 --- a/config-debug +++ b/config-debug @@ -4,5 +4,5 @@ mkdir -p build cd build ../configure --enable-maintainer-mode \ --disable-shared --disable-pspell-compatibility\ - --enable-w-all-error + --enable-w-all-error \ --prefix="`pwd`/../inst" CFLAGS='-g' CXXFLAGS='-g' "$@" diff --git a/modules/speller/default/speller_impl.cpp b/modules/speller/default/speller_impl.cpp index 12e226a..83bf125 100644 --- a/modules/speller/default/speller_impl.cpp +++ b/modules/speller/default/speller_impl.cpp @@ -229,7 +229,9 @@ namespace aspeller { if (cw.single()) return false; bool ok = true; CheckInfo * ci_prev = NULL; + CheckInfo * ci_overflow = NULL; do { + if (ci_overflow) ci = ci_overflow; unsigned len = cw.word_len(); char save = word[len]; @@ -240,6 +242,10 @@ namespace aspeller { if (!found) { if (cpi) { + if (ci_overflow) { + cpi->count = 0; + return false; + } ci_last = ci; ok = false; ci->word.str = word; @@ -263,9 +269,8 @@ namespace aspeller { ci_prev = ci_last; ci = ci_last + 1; - if (ci >= ci_end) { - if (cpi) cpi->count = 0; - return false; + if (!ci_overflow && ci >= ci_end) { + ci_overflow = ci_last; } word = word + cw.rest_offset(); diff --git a/modules/speller/default/speller_impl.hpp b/modules/speller/default/speller_impl.hpp index 14a6933..2a24da8 100644 --- a/modules/speller/default/speller_impl.hpp +++ b/modules/speller/default/speller_impl.hpp @@ -131,6 +131,7 @@ namespace aspeller { unsigned run_together_limit, CheckInfo *, CheckInfo *, GuessInfo *); + bool check_single(char * word, /* it WILL modify word */ bool try_uppercase, diff --git a/test/camel-case b/test/camel-case new file mode 100755 index 0000000..3111a0f --- /dev/null +++ b/test/camel-case @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e +set -x + +export PATH="`pwd`"/inst/bin:$PATH + +checkString () { + echo $1 | aspell --camel-case -a > tmp/camel-case-res +} + +checkString 'thisCamelCaseStringHasSevenWords' +if grep '^-$' tmp/camel-case-res; then + echo "pass" +else + echo "fail:" + cat tmp/camel-case-res + exit 1 +fi + +checkString 'thisCamelCaseStringHasMoreThanEightWords' +if grep '^-$' tmp/camel-case-res; then + echo "pass" +else + echo "fail:" + cat tmp/camel-case-res + exit 1 +fi