Revise the column width calculation
The last column in a line continues to the end of the line, and may overhang any subsequent columns in other lines.
This commit is contained in:
+14
-8
@@ -684,11 +684,16 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
DrawText(hDC, NH_A2W(p1, wbuf, BUFSZ), strlen(p1), &drawRect,
|
DrawText(hDC, NH_A2W(p1, wbuf, BUFSZ), strlen(p1), &drawRect,
|
||||||
DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_EXPANDTABS
|
DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_EXPANDTABS
|
||||||
| DT_SINGLELINE);
|
| DT_SINGLELINE);
|
||||||
data->menui.menu.tab_stop_size[column] =
|
int width = drawRect.right - drawRect.left;
|
||||||
max(data->menui.menu.tab_stop_size[column],
|
/* The last column overhangs any subsequent columns in other
|
||||||
drawRect.right - drawRect.left);
|
lines */
|
||||||
|
if (p != NULL) {
|
||||||
menuitemwidth += data->menui.menu.tab_stop_size[column];
|
data->menui.menu.tab_stop_size[column] =
|
||||||
|
max(data->menui.menu.tab_stop_size[column], width);
|
||||||
|
menuitemwidth += data->menui.menu.tab_stop_size[column];
|
||||||
|
} else {
|
||||||
|
menuitemwidth += width;
|
||||||
|
}
|
||||||
|
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
*p = '\t';
|
*p = '\t';
|
||||||
@@ -1182,7 +1187,8 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
p = strchr(item->str, '\t');
|
p = strchr(item->str, '\t');
|
||||||
column = 0;
|
column = 0;
|
||||||
SetRect(&drawRect, x, lpdis->rcItem.top,
|
SetRect(&drawRect, x, lpdis->rcItem.top,
|
||||||
min(x + data->menui.menu.tab_stop_size[0], lpdis->rcItem.right),
|
p != NULL ? x + data->menui.menu.tab_stop_size[0]
|
||||||
|
: lpdis->rcItem.right,
|
||||||
lpdis->rcItem.bottom);
|
lpdis->rcItem.bottom);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
TCHAR wbuf2[BUFSZ];
|
TCHAR wbuf2[BUFSZ];
|
||||||
@@ -1199,8 +1205,8 @@ onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
p = strchr(p1, '\t');
|
p = strchr(p1, '\t');
|
||||||
drawRect.left = drawRect.right + TAB_SEPARATION;
|
drawRect.left = drawRect.right + TAB_SEPARATION;
|
||||||
++column;
|
++column;
|
||||||
drawRect.right = min(drawRect.left + data->menui.menu.tab_stop_size[column],
|
drawRect.right = p != NULL ? drawRect.left + data->menui.menu.tab_stop_size[column]
|
||||||
lpdis->rcItem.right);
|
: lpdis->rcItem.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw focused item */
|
/* draw focused item */
|
||||||
|
|||||||
Reference in New Issue
Block a user