Autoscaling of images in viewer with Marked sidebar

BUG: autoscaling of images in viewer does not work right if the sidebar of marked images is visible.

with portrait orientation it seems that normally scales both the viewer window to the whole sceen height, fits the image height and makes the window width as wide as necessary.
with the sidebar open it seems it does the above steps and THEN cuts away the space that the sidebar needs from the display area with only adjusting the image size to the smaller display area. However, this makes the resulting image smaller and the images height is not fit into the window height anymore.

solution: the sidebar should not cut space away from the display area but should simply be appended to the window width (as long as there is enough screen space, ofc).

Could you please post a screenshot or two to illustrate what you mean?

standard view, ok:



with sidebar, unnecessarily unused areas (program underneath is gimp in order to show the screen size):

with sidebar, how it should be: