-
Notifications
You must be signed in to change notification settings - Fork 272
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
Improve detection of English contractions and other use of single quotes #322
Conversation
Temporarily add ' (single quote) to WORDCHARS to be able to parse whole words containing a single quote (like doesn't and similar in English). Closes geany#320.
scintilla_send_message(doc->editor->sci, SCI_GETWORDCHARS, 0, (sptr_t)wordchars_orig); | ||
if (! strchr(wordchars_orig, '\'')) | ||
{ | ||
GString *wordchars_new = g_string_new(wordchars_orig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depending on whether it's a hot spot, you could also simply add the '
to the orig string and truncate the last byte afterward (instead of copying the string)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, nice idea. What exactly do you mean by "whether it's a hot spot"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether the code is "hot" (called often), so basically whether optimizing this is worth the (trivial) added subtlety.
LGTM, but if people use |
Yes, when anything else is used for contractions/short forms than a single quote, it will fail. Though, to my knowledge, this also would not correct English then anymore. |
|
Improve detection of English contractions and other use of single quotes
Temporarily add ' (single quote) to WORDCHARS to be able to parse
whole words containing a single quote (like doesn't and similar in English).
Closes #320.