Automatically add space to end of line
Is there a way to automatically add spaces if one arrows right at the end of the line rather than wrap?
I’m not sure exactly where you’re heading with your question, however, it might be worth pointing out that if you are simply trying to quickly move to a column beyond the normal end-of-line (so that you can start typing something beginning in that column), clicking in the desired spot with the mouse while you hold the Alt key will get the caret there.
From that point when you begin typing, spaces will be inserted from the old end-of-line to the new caret column, followed by the text you typed.
Strangely, there is an exception if the first key you press is Enter. In that case no spaces are added.
That is interesting. I guess the obvious workaround for that is space, backspace, and then Enter.
Up to now, I thought that the unique way to get the virtual space functionality, was to define the message 2596, with the appropriate value, with the help of a Python, Lua or NppExec script. Refer to the Scintilla documentation, below :
So, after many years of work, with N++, I haven’t guessed, yet, your simple tip : ALT + Left mouse click, anywhere, in the editor window ! Really incredible ! Many thanks , Scott, for that hint, indeed :-)
It works because the Alt+Lclick is really starting a column-block, just no drag while holding Alt down to define that block. Column-blocking, out of necessity, needs to work with virtual spacing as some lines that may be in the column block might be shorter than others.
I don’t turn on permanently the beyond end-of-line movement modification as guy038 describes, because I found that that causes some strange behavior with auto-indentation in the language I typically use most often (Python). Actually, I do have a pythonscript tied to a keypress that toggles cursor end-of-line “freedom” mode on and off for when I want it.