From ccb7005dc6325fc863a97876cd51dbc5a72cb167 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 20 Jun 2018 18:56:03 -0400 Subject: [PATCH] Properly clipped the edit within the listview. --- windows/tableediting.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/windows/tableediting.cpp b/windows/tableediting.cpp index 35540e1f..bff84937 100644 --- a/windows/tableediting.cpp +++ b/windows/tableediting.cpp @@ -11,7 +11,7 @@ static HRESULT resizeEdit(uiTable *t, WCHAR *wstr, int iItem, int iSubItem) HFONT prevFont; TEXTMETRICW tm; SIZE textSize; - RECT editRect; + RECT editRect, clientRect; HRESULT hr; hr = uiprivTableGetMetrics(t, iItem, iSubItem, &m); @@ -41,7 +41,11 @@ static HRESULT resizeEdit(uiTable *t, WCHAR *wstr, int iItem, int iSubItem) // and make the bottom equally positioned to the top r.bottom = r.top + editRect.top + tm.tmHeight + editRect.top; - // TODO intersect r with the list view's client rect to prevent clipping + // make sure the edit box doesn't stretch outside the listview + // the list view just does this, which is dumb for when the list view wouldn't be visible at all, but given that it doesn't scroll the edit into view either... + // TODO check errors + GetClientRect(t->hwnd, &clientRect); + IntersectRect(&r, &r, &clientRect); // TODO check error or use the right function SetWindowPos(t->edit, NULL,