riched20: Rewrite the run whitespace test to take a run parameter.
This commit is contained in:
parent
29e54f07f7
commit
76cfe7dc50
|
@ -104,7 +104,6 @@ ME_String *ME_StrDup(const ME_String *s) DECLSPEC_HIDDEN;
|
|||
void ME_DestroyString(ME_String *s) DECLSPEC_HIDDEN;
|
||||
void ME_AppendString(ME_String *s1, const ME_String *s2) DECLSPEC_HIDDEN;
|
||||
ME_String *ME_VSplitString(ME_String *orig, int nVPos) DECLSPEC_HIDDEN;
|
||||
int ME_IsWhitespaces(const ME_String *s) DECLSPEC_HIDDEN;
|
||||
int ME_FindNonWhitespaceV(const ME_String *s, int nVChar) DECLSPEC_HIDDEN;
|
||||
int ME_CallWordBreakProc(ME_TextEditor *editor, ME_String *str, INT start, INT code) DECLSPEC_HIDDEN;
|
||||
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -394,6 +394,17 @@ static BOOL run_is_splittable( const ME_Run *run )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL run_is_entirely_ws( const ME_Run *run )
|
||||
{
|
||||
WCHAR *str = get_text( run, 0 ), *p;
|
||||
int i, len = run->strText->nLen;
|
||||
|
||||
for (i = 0, p = str; i < len; i++, p++)
|
||||
if (!ME_IsWSpace( *p )) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ME_UpdateRunFlags
|
||||
*
|
||||
|
@ -416,8 +427,9 @@ void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run)
|
|||
else
|
||||
run->nFlags &= ~MERF_SPLITTABLE;
|
||||
|
||||
if (!(run->nFlags & MERF_NOTEXT)) {
|
||||
if (ME_IsWhitespaces(strText))
|
||||
if (!(run->nFlags & MERF_NOTEXT))
|
||||
{
|
||||
if (run_is_entirely_ws( run ))
|
||||
run->nFlags |= MERF_WHITESPACE | MERF_STARTWHITE | MERF_ENDWHITE;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -108,19 +108,6 @@ ME_String *ME_VSplitString(ME_String *orig, int charidx)
|
|||
return s;
|
||||
}
|
||||
|
||||
int ME_IsWhitespaces(const ME_String *s)
|
||||
{
|
||||
/* FIXME multibyte */
|
||||
WCHAR *pos = s->szData;
|
||||
while(ME_IsWSpace(*pos++))
|
||||
;
|
||||
pos--;
|
||||
if (*pos)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars)
|
||||
{
|
||||
int end_ofs = nVChar + nChars;
|
||||
|
|
Loading…
Reference in New Issue