diff options
author | nyamatongwe <unknown> | 2005-06-02 02:19:43 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2005-06-02 02:19:43 +0000 |
commit | 6dbe83dc76483b9c3072e0f5f9bc4e7019c6cc05 (patch) | |
tree | 412e26e9d944c40e2f2837c9f6e5342507b271d8 | |
parent | 80f9bc1a615da214aadb989cd045c59cf6f1878d (diff) | |
download | scintilla-mirror-6dbe83dc76483b9c3072e0f5f9bc4e7019c6cc05.tar.gz |
Tweaked autocompletion width a little so that it is more likely to fit all
strings when the string with the most characters contains narrow
characters.
-rw-r--r-- | win32/PlatWin.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index c7435f212..db572a5dd 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1121,9 +1121,9 @@ PRectangle ListBoxX::GetDesiredRect() { int len = widestItem ? strlen(widestItem) : 0; if (unicodeMode) { wchar_t tbuf[MAX_US_LEN]; - int tlen = UCS2FromUTF8(widestItem, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1); - tbuf[tlen] = L'\0'; - ::GetTextExtentPoint32W(hdc, tbuf, tlen, &textSize); + len = UCS2FromUTF8(widestItem, len, tbuf, sizeof(tbuf)/sizeof(wchar_t)-1); + tbuf[len] = L'\0'; + ::GetTextExtentPoint32W(hdc, tbuf, len, &textSize); } else { ::GetTextExtentPoint32(hdc, widestItem, len, &textSize); } @@ -1132,8 +1132,10 @@ PRectangle ListBoxX::GetDesiredRect() { maxCharWidth = tm.tmMaxCharWidth; SelectFont(hdc, oldFont); ::ReleaseDC(lb, hdc); - if (textSize.cx > width) - width = textSize.cx; + + int widthDesired = Platform::Maximum(textSize.cx, (len + 1) * tm.tmAveCharWidth); + if (width < widthDesired) + width = widthDesired; rcDesired.right = rcDesired.left + TextOffset() + width + (TextInset.x * 2); if (Length() > rows) |