Subject: Re: bug#16470: 24.3.50; term mode and newlines with some window configurations

From: martin rudalics <[email-masked]>
Date: Sat, 18 Jan 2014 13:07:03 +0100

>> I suppose it is a rounding issue.  Does it happen only in the right-most
 >> window?
 >
 > In 24.3, I have the following window-width results: 71 - 70 - 70
 > In 24.4, I have 71 - 71 - 71

Sorry, I meant "does the unwanted wrapping happen only in the right-most
window".  But IIUC you below answered that by saying that it's OK only
in the left-most window.

So I still suppose it's a rounding problem.  IIRC with Emacs 24.3 the
right-most window could have a pixel width larger than an integer
multiple of its character width so it implicitly rounded _down_ the
character width of any window (Emacs 24.3 was silent about pixel widths
of windows).  Emacs 24.4 can round _up_ the character width of any window
such that the sum of the character widths of all siblings invariantly
equals the character width of the parent window.  This might fool the
`term-window-width' function in a way I have to find out yet.

Meanwhile please do the following: Evaluate the two functions attached
at the bottom (with Emacs 24.4 only) and do

(1) M-x frame-dump _before_ balancing windows and post the result (from
     the buffer *frame-dump*) here.

(2) M-x frame-dump _after_ balancing windows and post the result (from
     the buffer *frame-dump*) here.

Thanks, martin

(defun window-dump (window)
   "Dump WINDOW."
   (insert
    (format "%s   parent: %s\n" window (window-parent window))
    (format "pixel left: %s   top: %s   size: %s x %s   new: %s\n"
	   (window-pixel-left window) (window-pixel-top window)
	   (window-size window t t) (window-size window nil t)
	   (window-new-pixel window))
    (format "char left: %s   top: %s   size: %s x %s   new: %s\n"
	   (window-left-column window) (window-top-line window)
	   (window-total-size window t) (window-total-size window)
	   (window-new-total window))
    (format "normal: %s x %s   new: %s\n"
	   (window-normal-size window t) (window-normal-size window)
	   (window-new-normal window)))
   (when (window-live-p window)
     (insert
      (format "body pixel: %s x %s   char: %s x %s\n"
	     (window-body-width window t) (window-body-height window t)
	     (window-body-width window) (window-body-height window))))
   (insert "\n"))

(defun frame-dump (&optional frame)
   "Dump frame FRAME to buffer *frame-dump*.
FRAME defaults to the selected frame."
   (interactive)
   (setq frame (window-normalize-frame frame))
   (with-current-buffer (get-buffer-create "*frame-dump*")
     (erase-buffer)
     (insert
      (format "frame pixel: %s x %s   cols/lines: %s x %s   units: %s x %s\n"
	     (frame-pixel-width frame) (frame-pixel-height frame)
	     (frame-total-cols frame) (frame-text-lines frame) ; (frame-total-lines frame)
	     (frame-char-width frame) (frame-char-height frame))
      (format "frame text pixel: %s x %s   cols/lines: %s x %s\n"
	     (frame-text-width frame) (frame-text-height frame)
	     (frame-text-cols frame) (frame-text-lines frame))
      (format "tool: %s  scroll: %s  fringe: %s  border: %s  right: %s  bottom: %s\n\n"
	     (tool-bar-height frame t)
	     (frame-scroll-bar-width frame)
	     (frame-fringe-width frame)
	     (frame-border-width frame)
	     (frame-right-divider-width frame)
	     (frame-bottom-divider-width frame)))
     (walk-window-tree 'window-dump frame t t)))