MCPcopy Create free account
hub / github.com/WinMerge/winmerge / isWordBreak

Function isWordBreak

Src/stringdiffs.cpp:792–826  ·  view source on GitHub ↗

* @brief Is it a non-whitespace wordbreak character (ie, punctuation)? */

Source from the content-addressed store, hash-verified

790 * @brief Is it a non-whitespace wordbreak character (ie, punctuation)?
791 */
792static bool
793isWordBreak(int breakType, const tchar_t *str, int index)
794{
795 tchar_t ch = str[index];
796 // breakType==1 means break also on punctuation
797 if ((ch & 0xff00) == 0)
798 {
799// tchar_t nextCh = str[index + 1];
800 // breakType==0 means whitespace only
801 if (breakType==0)
802 return false;
803 return tc::tcschr(BreakChars, ch) != nullptr;
804 }
805 else
806 {
807// if (
808// ch==0xff0c/* Fullwidth Full Stop */ ||
809// ch==0xff0e/* Fullwidth Comma */ ||
810// ch==0xff1b/* Fullwidth Semicolon */ ||
811// ch==0xff1a/* Fullwidth Colon */ ||
812// ch==0x3002/* Ideographic Full Stop */ ||
813// ch==0x3001/* Ideographic Comma */
814// )
815// return true;
816// WORD wCharType, wCharTypeNext;
817// GetStringTypeW(CT_CTYPE3, &ch, 1, &wCharType);
818// tchar_t nextCh = str[index + 1];
819// GetStringTypeW(CT_CTYPE3, &nextCh, 1, &wCharTypeNext);
820// return (wCharType != wCharTypeNext);
821//
822 WORD wCharType = 0;
823 GetStringTypeW(CT_CTYPE1, &ch, 1, &wCharType);
824 return !(wCharType & (C1_UPPER | C1_LOWER | C1_DIGIT));
825 }
826}
827
828
829/**

Callers 1

BuildWordsArrayMethod · 0.85

Calls 1

tcschrFunction · 0.85

Tested by

no test coverage detected