All I can do is point you at the listings docs and suggest that there is a section therein named "Margins and line shape". Are these options among those that you have tried?
In particular I see options with names like linewidth, breaklines, and breakautoindent which cetainly suggests that listings supports your needs.
dmckee
2009-06-11 13:43:46