0

Solving the problem of adding single-line comments that span multiple lines

Josef . 12 years ago 0

Common scenario: Annotate a multiline code with single-line comments on the right side. If the lines are uneven in lengths, comments have to be aligned/padded manually by holding down the spacebar, which is kind of inconvenient.


The easiest solution is a feature I've seen in the editor ConTEXT, which I haven't used for many years now. It basically allowed clicking anywhere, and padded the file with whitespaces so that the cursor was actually there. At the end of an existing line the line it added SP characters, below the last line NL/CR.


A more advanced feature would be dragging a local textbox open in the source file, in which line breaks are automatically introduced, and the left side is neatly aligned. (Haven't seen that anywhere yet, so you'll most likely not run into patent problems) ;-)