If I select only the red portion of the following text:
<TAB><TAB>ITreeLevel<CR>
... and then press the "#" key, the text is changed to:
<TAB><TAB>#ifdef _DEBUG<CR>
<TAB><TAB>ITreeLevel#endif // _DEBUG<CR>
<TAB><TAB><CR>
... with only the red portion selected (I can't display reverse video here). Note that the #endif is on the same line as ITreeLevel.
Now if I press the "#" key again, which is supposed to toggle it, I end up with:
<TAB><TAB>#ifdef _DE#ifdef _DEBUG<CR>
<TAB><TAB>BUG<CR>
<TAB><TAB><TAB><TAB>ITreeLevel#endif // _DEBUG<CR>
<TAB><TAB><TAB><TAB>#endif // _DEBUG<CR>
... which is pretty much a mess...
Note that ITreeLevel starts off indented two tabs to the right; if I remove the indentation, then toggling works correctly.
Also, note that if I select the <CR> at the end of line, then it all works correctly.