Fixed hidePreviewPane working improperly after swap views, updated code style