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

[spellchecker] Apostrophes (', ascii 39) at string boundary are spell-checked #484

Closed
12345ieee opened this issue Sep 18, 2016 · 7 comments

Comments

@12345ieee
Copy link

12345ieee commented Sep 18, 2016

Testcases:

  • 'word' all underlined
  • "word" not underlined
  • 'very long phrase' 'very and phrase' are underlined

This was probably introduced in #322 .

The spellchecker ought to strip the quotes before checking, otherwise using it in python is a huge pain.

I understand it's difficult to strip quotes, though, because it's not obvious what is a string boundary.
E.g. latex and python users would have completely different expectations.

Maybe a configurable option of "additional splitting chars"?

@eht16
Copy link
Member

eht16 commented Sep 18, 2016

Yes, this is a regression from #322.

I tried a quick hack which strips the apostrophe from the word beginning and end if the style before resp. after the word is different. In this context style means highlighting types like string, identifier, keyword and similar. This works pretty good for your examples but it fails on Python's triple strings (`'''...'''').

Another, simpler approach could be to strip any apostrophes at word start and end. This might accidentally delete a legit apostrophe like in plural forms of the possessive case (e.g. The players’ boots) but this should have no negative effect on spell checking as the rest of the word must be valid anyway, I hope.

@12345ieee
Copy link
Author

Your second solution will generate some problems in languages like Italian, where po' is a word, but po isn't, but these are few corner cases that can be added to the dictionary when you meet them and a huge improvement wrt the current state.

eht16 added a commit to eht16/geany-plugins that referenced this issue Oct 11, 2016
Skipping quotes on word stripping should not be necessary any longer
since we add the single quote character to the wordchars list
(eaad256).

Fixes geany#484.
@eht16
Copy link
Member

eht16 commented Oct 11, 2016

Thanks for the feedback.
In my tests po' was not marked as mispelled but that might because the dictionary knows the word Po as the river already. I assume there might be other examples like this one, as long as there are somewhat rare, that might be ok.

I created #487 to fix the issues you reported, I tested your examples as well as my usual spell check test texts and it seems to work well.

@12345ieee
Copy link
Author

Any way I can (easily) get the new version?

@eht16
Copy link
Member

eht16 commented Oct 13, 2016

It depends what OS you use.
On Linux compiling from source is quite easy:

git clone git://github.com/geany/geany
cd geany
./autogen.sh --prefix=/tmp/geany_test
make
make install

cd ..
git clone git://github.com/geany/geany-plugins
cd geany-plugins
git checkout -b spellcheck_strip_quotes_issue484
PKG_CONFIG_PATH=/tmp/geany_test/lib/pkgconfig ./autogen.sh --prefix=/tmp/geany_test --with-geany-libdir=/tmp/geany_test/lib/geany
make
make install

The current version is as stable as a release usually, so there should not be a big issue.
It's important that you have automake, autoconf, make, the development libraries of GTK and Enchant (for Spell Check) installed.
The commands above will compile and install Geany and Geany-Plugins into /tmp/geany_test. You can start it with /tmp/geany_test/bin/geany -c /tmp/geany_test/config using a fresh configuration to not interfer with your current config. Then activate the Spell Check plugin and test.

@12345ieee
Copy link
Author

I brutally replaced spellcheck.so in /usr/lib and tested it a bit.
It seems to work perfectly well.

Thanks for the fix.

@eht16
Copy link
Member

eht16 commented Oct 14, 2016

Heh, this is also possible even as you said some sort of brutal :).
Thanks for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants