(To appear in the Journal "Science of Computer Programming", 2008)
Pretty-printers reduce the time programmers spend reading and understanding code. Pretty-printers found in modern development environments are hand crafted for responsiveness, an imperative property for interactive environments. However, these pretty-printers are language specific, tightly integrated into development environments, and have limited customizability. The literature describes how to generate pretty-printers that are customizable and reusable, and that are make efficient use of the presentation space. However, these pretty-printers only provide a global rendering capacity, i.e., they can only render entire files. This reduces responsiveness, preventing their use in modern development environments. We present a flexible, stable, peephole-efficient pretty-printing algorithm for generated pretty-printers. It is flexible in that it is capable of screen-optimized layouts, and also supports fisheye views. The algorithm is peephole-efficient, in that it performs work proportional to the size of the visible window and not the size of the entire file. Finally, the algorithm is stable, in that the rendered view is identical to that which would be produced by formatting the entire file.