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

Remove camel case limit #653

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config-debug
Original file line number Diff line number Diff line change
Expand Up @@ -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' "$@"
11 changes: 8 additions & 3 deletions modules/speller/default/speller_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions modules/speller/default/speller_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 28 additions & 0 deletions test/camel-case
Original file line number Diff line number Diff line change
@@ -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