Something is wrong with the Windows code...

This commit is contained in:
Pietro Gagliardi 2017-02-10 20:37:05 -05:00
parent 6acb10a4fc
commit 5a1c733841
2 changed files with 7 additions and 6 deletions

View File

@ -2,6 +2,7 @@
#include "../ui.h" #include "../ui.h"
#include "uipriv.h" #include "uipriv.h"
// TODO figure out how to make this work on GTK+
void uiDrawCaret(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t pos, int *line) void uiDrawCaret(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t pos, int *line)
{ {
double xoff; double xoff;

View File

@ -21,12 +21,11 @@ static HRESULT itemize(WCHAR *s, size_t len, SCRIPT_ITEM **out, int *outn)
int n; int n;
HRESULT hr; HRESULT hr;
// make sure these are zero-initialized to avoid mangling the text
ZeroMemory(&sc, sizeof (SCRIPT_CONTROL));
ZeroMemory(&ss, sizeof (SCRIPT_STATE));
maxItems = len + 2; maxItems = len + 2;
for (;;) { for (;;) {
// make sure these are zero-initialized to avoid mangling the text
ZeroMemory(&sc, sizeof (SCRIPT_CONTROL));
ZeroMemory(&ss, sizeof (SCRIPT_STATE));
items = new SCRIPT_ITEM[maxItems + 1]; items = new SCRIPT_ITEM[maxItems + 1];
hr = ScriptItemize(s, len, hr = ScriptItemize(s, len,
maxItems, maxItems,
@ -101,8 +100,9 @@ struct graphemes *graphemes(void *s, size_t len)
delete[] logattr; delete[] logattr;
} }
// and handle the last item for the end of the string // and handle the last item for the end of the string
*pGTP++ = items[nItems].iCharPos; *pGTP = items[nItems].iCharPos;
*pPTG++ = pGTP - g->graphemesToPoints; *pPTG = pGTP - g->graphemesToPoints;
// TODO is any of the above broken?... also for all platforms, are the last few bytes not covered?
delete[] items; delete[] items;
return g; return g;