X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=dll%2Fwin32%2Friched20%2Fstyle.c;h=bb2f808954ac0aedf1189809a00b0db591eafbf7;hp=a3b532ebd43cf600c0dfa3a56e3f29440502cc45;hb=b6edb50eb1a2311af040aadeec7791efa270a72e;hpb=c16ad873a687c7fc3ec343b972e038e153a75e8b diff --git a/dll/win32/riched20/style.c b/dll/win32/riched20/style.c index a3b532ebd43..bb2f808954a 100644 --- a/dll/win32/riched20/style.c +++ b/dll/win32/riched20/style.c @@ -156,6 +156,7 @@ ME_Style *ME_MakeStyle(CHARFORMAT2W *style) { s->hFont = NULL; s->tm.tmAscent = -1; all_refs++; + TRACE_(richedit_style)("ME_MakeStyle %p, total refs=%d\n", s, all_refs); return s; } @@ -449,6 +450,7 @@ void ME_AddRefStyle(ME_Style *s) assert(s->nRefs>0); /* style with 0 references isn't supposed to exist */ s->nRefs++; all_refs++; + TRACE_(richedit_style)("ME_AddRefStyle %p, new refs=%d, total refs=%d\n", s, s->nRefs, all_refs); } void ME_ReleaseStyle(ME_Style *s) @@ -465,16 +467,15 @@ void ME_ReleaseStyle(ME_Style *s) ME_DestroyStyle(s); } -ME_Style *ME_GetInsertStyle(ME_TextEditor *editor, int nCursor) { +ME_Style *ME_GetInsertStyle(ME_TextEditor *editor, int nCursor) +{ if (ME_IsSelection(editor)) { - ME_Cursor c; - int from, to; - + ME_Cursor *from, *to; + ME_GetSelection(editor, &from, &to); - ME_CursorFromCharOfs(editor, from, &c); - ME_AddRefStyle(c.pRun->member.run.style); - return c.pRun->member.run.style; + ME_AddRefStyle(from->pRun->member.run.style); + return from->pRun->member.run.style; } if (editor->pBuffer->pCharStyle) { ME_AddRefStyle(editor->pBuffer->pCharStyle);