diff options
| author | nyamatongwe <devnull@localhost> | 2005-06-02 02:19:43 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2005-06-02 02:19:43 +0000 | 
| commit | 0e7f2d4efecc65e4656ee7bf4e31c0894b5bd904 (patch) | |
| tree | 412e26e9d944c40e2f2837c9f6e5342507b271d8 /win32/PlatWin.cxx | |
| parent | d37ef88d85cf2a2e5d34322a76220cf64e918a7a (diff) | |
| download | scintilla-mirror-0e7f2d4efecc65e4656ee7bf4e31c0894b5bd904.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.
Diffstat (limited to 'win32/PlatWin.cxx')
| -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) | 
