From 8a36f2a3250085e4eddbd4e8f8a3b3132629608c Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Fri, 22 Jul 2005 18:27:26 +0000 Subject: [PATCH] Fixed EM_GETCHARFORMAT for selection containing a single character. --- dlls/riched20/run.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c index 1830ba3dc5f..eab74012fe1 100644 --- a/dlls/riched20/run.c +++ b/dlls/riched20/run.c @@ -642,9 +642,6 @@ void ME_GetCharFormat(ME_TextEditor *editor, int nFrom, int nTo, CHARFORMAT2W *p int nOffset, nOffset2; CHARFORMAT2W tmp; - if (nTo>nFrom) /* selection consists of chars from nFrom up to nTo-1 */ - nTo--; - ME_RunOfsFromCharOfs(editor, nFrom, &run, &nOffset); if (nFrom == nTo) /* special case - if selection is empty, take previous char's formatting */ { @@ -659,6 +656,9 @@ void ME_GetCharFormat(ME_TextEditor *editor, int nFrom, int nTo, CHARFORMAT2W *p ME_GetRunCharFormat(editor, run, pFmt); return; } + + if (nTo>nFrom) /* selection consists of chars from nFrom up to nTo-1 */ + nTo--; ME_RunOfsFromCharOfs(editor, nTo, &run_end, &nOffset2); ME_GetRunCharFormat(editor, run, pFmt);