Guru: Remove Unwanted Trailing Blanks With LPEX
September 11, 2017 Ted Holt
Giving up RDi and going back to developing with PDM and SEU would appeal to me as much as giving up electricity and running water and moving into a pup tent. RDi has so many nice features that enrich my life. However, RDi does have its quirks, and occasionally I run into one of them.
One of the nice features is the ability to comment and uncomment blocks of code in one fell swoop. In case you’ve forgotten (or didn’t know about) those shortcuts, Ctrl+/ comments out a line or block and Ctrl+\ removes the comment markers. I recommend you reread (or read) Susan Gantner’s article Everybody Likes Shortcuts! Part 2, Playing With Blocks to refresh (or acquaint) yourself with these shortcuts and more.
Sometimes when I attempt to comment a line or block, the LPEX editor refuses to co-operate and gives me a derogatory error message: Text limit would have been exceeded on line 9. The operation has been canceled.
Notice that I said sometimes. When I open a member for edit, LPEX may or may not retain trailing blanks on the end of each source line. I’ve tried to find a reason for this inconsistent behavior, but so far none of my theories have survived my testing. If you know, please enlighten me. I’ve about decided it’s a bug.
Fortunately, this is an easy problem to solve. Press the Esc key to move the cursor to the LPEX command line just below the source code. (You can also click in the command line box.) Type the word trim and press Enter. Press Esc to move back into the source code.
Now Ctrl+/ turns the marked code or current line into a comment.
If you want to see whether your code has trailing blanks or not, press Ctrl+A. This is how code looks with trailing blanks.
This is how source code looks without them.
Fantastic tip!! I’ve always wondered why this occasionally happened.
I believe that records in a source physical file member that are created/edited in SEU are saved with trailing blanks. Then, when you open them in LPEX, the trailing blanks are still there. If you edit a line in a source member in LPEX, the line is saved without trailing blanks.
The easiest way to do it — type a blank in the source and press CTRL+S
great tip Peder.