Properly resize sidebar after hiding panel, fixes #508