>>> The problem appears to be the lines: >>> >>> (size >>> (window-text-pixel-size window from to max-width max-height)) >>> >>> As the max-width will be larger than the current frame (meaning the >>> height calculation will not take wrapping into account). I think MAX-WIDTH should be nil here. >>> One possible fix is to set min/max height/width based on `only' to >>> (frame-parameter frame 'width) / (frame-parameter frame 'height) but I >>> do not know if that is the best fix. This would not work. The 'height' frame parameter counts in characters while 'window-text-pixel-size' wants pixels as X-LIMIT. Also, the sizes of frame and window decorations would hardly match. >>> If that is done, then it may be possible to remove the rest of the >>> special handling for `only' that sets width/height to nil and handles that. >> >> I think you're right, but I'd like to hear if Martin has any comments. > > Sounds good. The most minimal change I can think of is to use the > current frame's width as max-width in the window-text-pixel-size call > when only is set to vertically. I don't know of any reason we need to > constrain max-height in that call because it doesn't have the same > impact. That can be done either explicitly in that call or by changing > max-width to be set to the current width as I described before. That > would be asymmetrical with max-height though, which would be rather > confusing IMO. Please try the attached diff. Thanks, martin