mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 10:41:12 +00:00
richedit: Properly restore style after end of rtf group.
Rich text files have groupings of text, where styles are pushed onto the stack when encountering a start of the group, then popped at the end of the group. This was being handled improperly before, because a single styleChanged flag was being stored to keep track of whether the style needed to be restored at the end of a group. This fails to work properly since the single flag isn't keeping track of all the levels of the stack, so some styles are not restored properly.
This commit is contained in:
parent
94c7ab72f5
commit
c6cf567706
3 changed files with 13 additions and 12 deletions
|
@ -1345,7 +1345,8 @@ static void ME_RTFReadHook(RTF_Info *info)
|
|||
{
|
||||
case rtfBeginGroup:
|
||||
if (info->stackTop < maxStack) {
|
||||
info->stack[info->stackTop].fmt = info->style->fmt;
|
||||
info->stack[info->stackTop].style = info->style;
|
||||
ME_AddRefStyle(info->style);
|
||||
info->stack[info->stackTop].codePage = info->codePage;
|
||||
info->stack[info->stackTop].unicodeLength = info->unicodeLength;
|
||||
}
|
||||
|
@ -1354,7 +1355,6 @@ static void ME_RTFReadHook(RTF_Info *info)
|
|||
break;
|
||||
case rtfEndGroup:
|
||||
{
|
||||
ME_Style *s;
|
||||
RTFFlushOutputBuffer(info);
|
||||
info->stackTop--;
|
||||
if (info->stackTop<=0) {
|
||||
|
@ -1362,15 +1362,12 @@ static void ME_RTFReadHook(RTF_Info *info)
|
|||
return;
|
||||
}
|
||||
assert(info->stackTop >= 0);
|
||||
if (info->styleChanged)
|
||||
{
|
||||
/* FIXME too slow ? how come ? */
|
||||
s = ME_ApplyStyle(info->style, &info->stack[info->stackTop].fmt);
|
||||
ME_ReleaseStyle(info->style);
|
||||
info->style = s;
|
||||
info->codePage = info->stack[info->stackTop].codePage;
|
||||
info->unicodeLength = info->stack[info->stackTop].unicodeLength;
|
||||
}
|
||||
|
||||
ME_ReleaseStyle(info->style);
|
||||
info->style = info->stack[info->stackTop].style;
|
||||
ME_AddRefStyle(info->style);
|
||||
info->codePage = info->stack[info->stackTop].codePage;
|
||||
info->unicodeLength = info->stack[info->stackTop].unicodeLength;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -442,7 +442,11 @@ static void RTFUngetToken(RTF_Info *info)
|
|||
* increment the value to compensate for it being decremented
|
||||
* twice due to the RTFUngetToken. */
|
||||
if(RTFCheckCM (info, rtfGroup, rtfEndGroup))
|
||||
{
|
||||
info->stack[info->stackTop].style = info->style;
|
||||
ME_AddRefStyle(info->style);
|
||||
info->stackTop++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1095,7 +1095,7 @@ typedef void (*RTFFuncPtr) (RTF_Info *); /* generic function pointer */
|
|||
|
||||
/* RTF parser stack element */
|
||||
struct tagRTFState {
|
||||
CHARFORMAT2W fmt;
|
||||
ME_Style *style;
|
||||
int codePage;
|
||||
int unicodeLength;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue