Hi!
I took a look at this from the NS port point of view.
Setting the `left-frame' frame parameter to any from 1 and up change the width of the fringe, while retaining the width of the text area (80 characters). However, setting it to 0 makes the text area wrap on 79 characters (despite there being space for the 80:th character) while `window-width' still returns 80.
Presumably, this is the root cause of the ansi-term problem.
However, to check if this was a NS specific problem, I tested this on a freshly built GTK+ emacs on LinuxMint. It turned out that it, too, suffers from the same problem, so I'm handing over this to you, Martin.
Steps to repeat:
emacs -Q
C-u 8 0 x RET
;; This inserts a line wide enough to reach the right side of the screen without wrapping)
(set-frame-parameter (selected-frame) 'left-fringe 50)
;; This makes the left fringe wide, the text area still holds the 80 x:s nicely.
(window-width)
;; 80
(set-frame-parameter (selected-frame) 'left-fringe 1)
;; Narrow left fringe. Text area still holds the x:s
(window-width)
;; 80
(set-frame-parameter (selected-frame) 'left-fringe 0)
;; The line of x:s wrap
(window-width)
;; 80 -- inconsistent with what is displayed on screen.
-- Anders