Huw Davies : riched20: Rewrite the run splittable test to take a run parameter.
Alexandre Julliard
julliard at winehq.org
Thu Jan 31 12:11:42 CST 2013
Module: wine
Branch: master
Commit: 29e54f07f7ad4857105f6d6efb78246db19bd3f1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=29e54f07f7ad4857105f6d6efb78246db19bd3f1
Author: Huw Davies <huw at codeweavers.com>
Date: Thu Jan 31 13:47:57 2013 +0000
riched20: Rewrite the run splittable test to take a run parameter.
---
dlls/riched20/editor.h | 1 -
dlls/riched20/run.c | 20 +++++++++++++++++++-
dlls/riched20/string.c | 15 ---------------
3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 94fb862..87dd288 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -105,7 +105,6 @@ 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_IsSplitable(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;
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 390e114..384baaa 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -376,6 +376,24 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
return pDI;
}
+static BOOL run_is_splittable( const ME_Run *run )
+{
+ WCHAR *str = get_text( run, 0 ), *p;
+ int i, len = run->strText->nLen;
+ BOOL found_ink = FALSE;
+
+ for (i = 0, p = str; i < len; i++, p++)
+ {
+ if (ME_IsWSpace( *p ))
+ {
+ if (found_ink) return TRUE;
+ }
+ else
+ found_ink = TRUE;
+ }
+ return FALSE;
+}
+
/******************************************************************************
* ME_UpdateRunFlags
*
@@ -393,7 +411,7 @@ void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run)
else
run->nFlags &= ~MERF_HIDDEN;
- if (ME_IsSplitable(strText))
+ if (run_is_splittable( run ))
run->nFlags |= MERF_SPLITTABLE;
else
run->nFlags &= ~MERF_SPLITTABLE;
diff --git a/dlls/riched20/string.c b/dlls/riched20/string.c
index db45d92..02f1480 100644
--- a/dlls/riched20/string.c
+++ b/dlls/riched20/string.c
@@ -121,21 +121,6 @@ int ME_IsWhitespaces(const ME_String *s)
return 1;
}
-int ME_IsSplitable(const ME_String *s)
-{
- WCHAR *pos = s->szData;
- WCHAR ch;
- while(ME_IsWSpace(*pos++))
- ;
- pos--;
- while((ch = *pos++) != 0)
- {
- if (ME_IsWSpace(ch))
- return 1;
- }
- return 0;
-}
-
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars)
{
int end_ofs = nVChar + nChars;
More information about the wine-cvs
mailing list