I had some problem hacking the redisplay code. For some reason, Emacs hangs after M-x toggle-word-wrap. I ran Emacs under lldb (gdb doesn’t work on Mac), and was dropped into different places each time. I attached the backtrace files. What could I did wrong? Explanation for the code: basically I added a predicate function (char_can_wrap) that checks text property to see if a character is “wrappable”. And combined that predicate with the existing IT_DISPLAYING_WHITESPACE. Yuan