1
0
Fork 0

(svn r14518) -Fix (r14514): forgot win32 and OS/2 files (glx)

release/0.7
smatz 2008-10-22 20:23:50 +00:00
parent f43dc3e758
commit 1e7e5fb175
2 changed files with 8 additions and 8 deletions

View File

@ -196,7 +196,7 @@ bool InsertTextBufferClipboard(Textbuf *tb)
{ {
uint w; uint w;
if (tb->length + length >= tb->maxlength - 1) break; if (tb->size + length + 1 > tb->maxsize) break;
w = GetCharacterWidth(FS_NORMAL, (byte)*i); w = GetCharacterWidth(FS_NORMAL, (byte)*i);
if (tb->maxwidth != 0 && width + tb->width + w > tb->maxwidth) break; if (tb->maxwidth != 0 && width + tb->width + w > tb->maxwidth) break;
@ -205,11 +205,11 @@ bool InsertTextBufferClipboard(Textbuf *tb)
length++; length++;
} }
memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->length - tb->caretpos + 1); memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->size - tb->caretpos);
memcpy(tb->buf + tb->caretpos, text, length); memcpy(tb->buf + tb->caretpos, text, length);
tb->width += width; tb->width += width;
tb->caretxoffs += width; tb->caretxoffs += width;
tb->length += length; tb->size += length;
tb->caretpos += length; tb->caretpos += length;
WinCloseClipbrd(hab); WinCloseClipbrd(hab);

View File

@ -1138,7 +1138,7 @@ bool InsertTextBufferClipboard(Textbuf *tb)
if (!IsPrintable(c)) break; if (!IsPrintable(c)) break;
byte len = Utf8CharLen(c); byte len = Utf8CharLen(c);
if (tb->length + length >= tb->maxlength - len) break; if (tb->size + length + len > tb->maxsize) break;
byte charwidth = GetCharacterWidth(FS_NORMAL, c); byte charwidth = GetCharacterWidth(FS_NORMAL, c);
if (tb->maxwidth != 0 && width + tb->width + charwidth > tb->maxwidth) break; if (tb->maxwidth != 0 && width + tb->width + charwidth > tb->maxwidth) break;
@ -1149,15 +1149,15 @@ bool InsertTextBufferClipboard(Textbuf *tb)
if (length == 0) return false; if (length == 0) return false;
memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->length - tb->caretpos); memmove(tb->buf + tb->caretpos + length, tb->buf + tb->caretpos, tb->size - tb->caretpos);
memcpy(tb->buf + tb->caretpos, utf8_buf, length); memcpy(tb->buf + tb->caretpos, utf8_buf, length);
tb->width += width; tb->width += width;
tb->caretxoffs += width; tb->caretxoffs += width;
tb->length += length; tb->size += length;
tb->caretpos += length; tb->caretpos += length;
assert(tb->length < tb->maxlength); assert(tb->size <= tb->maxsize);
tb->buf[tb->length] = '\0'; // terminating zero tb->buf[tb->size - 1] = '\0'; // terminating zero
return true; return true;
} }