Need to set tab STOPS, not spacing.
-
@Ekopalypse said in Need to set tab STOPS, not spacing.:
but I understand
Okay, from your screenshot it seemed apparent that you DIDN’T understand. But now I DO think you understand. :-)
BTW, ping echo received…next packet being formulated. :-)
-
- Yes, I am looking for something like what you’ve pictured
- Yes, it would only be used with fixed-spaced fonts. Why would anyone need or want a proportional font with program source code?
- Short testing? Assigned to each line? Reapplied if buffer get(s) reactivated? Please explain. Have you actually done this, tested it, etc.?
- If it can be achieved with a scripting language plugin, does such a plugin exist? If not, where are the specifications for writing such a plugin?
-
Yes, it would only be used with fixed-spaced fonts. Why would anyone need or want a proportional font with program source code?
No idea, but who knows :-)
Short testing? Assigned to each line? Reapplied if buffer get(s) reactivated? Please explain. Have you actually done this, tested it, etc.?
If it can be achieved with a scripting language plugin, does such a plugin exist? If not, where are the specifications for writing such a plugin?
Scintilla, the underlying control npp uses, provides functions which seem to do what you try to achieve.
I used PythonScript to give it a quick test to see if it is possible at all and it looks like it is. (tabs in my screenshot were created by using PythonScript)To my knowledge there are currently a python, lua, javascript and an activex (not sure if this still works)
scripting plugins available which can be used to manipulate scintilla/notepad++.But a dedicated plugin doing the same can be developed as well.
What I’ve found out, what needs to be done so far is the following
- determine the pixel size of the current used font
- on_buffer_activated callback (is called on open doc or when switching from another doc) apply the tabstops to every line of code
- on_update_ui (is called whenever something change in the current document) do the same or find a clever algo to identify the changed/new lines
I can try to create a pythonscript, which means you have to install the pythonscript plugin,
but don’t expect it to work without errors as I haven’t done anything related to tabstops yet. -
@ekopalypse What happened to this thread? Did somebody manage to define variable widths between tab stops? For the older fixed-format languages (dating back to punch cards) it would be a very useful feature.
-
@paul-wormer said in Need to set tab STOPS, not spacing.:
What happened to this thread?
I think what happened is that the OP didn’t respond and express continued interest, so @Ekopalypse didn’t continue expending effort on it.
I would like to see such a thing, but where no tab characters are used (only spaces). I think I could put that to some good use, but until I see it I won’t know for sure.
-
@alan-kilborn
If I’m correctly understanding the problem the OP was asking for, it sounds like the old ways we were able to setup a wordprocessor like WordPerfect and such, so that you set the tab stops at predefined areas you wanted to start sections at instead of having auto indents setting of so many spaces. When I see Tabs in a menu option, I personally expect to see that kind of a reference (tab stops) rather than shortcuts to choose a different tab (window/folder). :-)I suspect, the implementation may be difficult since you have the column editing ability, and that may conflict with tabbing as a formatting tool?
Lee
-
@lycan-thrope said in Need to set tab STOPS, not spacing.:
instead of having auto indents setting of so many spaces
Yes, I do realize my desire is somewhat “against the grain” of the OP’s request (the title of this thread, after all, is Need to set tab STOPS, not spacing).
But, for it (the general concept of a proposed solution) to be useful to me, it would have to consider spaces, because tab characters in my files are not allowed.
-
Yep, which is why the option of choosing the number of spaces to substitute for a tab was implemented in those old word processors. :-) They were, at the time, the best multi-tool we had, until syntax-highlighting became a desired tool for programmers and the editors took different directions at that point, for the most part, as I remember it. :-)
Lee
-
A little experimentation on my own shows that the Scintilla functions for this only work when true tab characters are used, and I have zero interest in that, so… I’m out.
-
@alan-kilborn said in Need to set tab STOPS, not spacing.:
when true tab characters are used
but after they’re inserted, can’t you have N++ set to convert to space?
Cheers.
-
@michael-vincent said in Need to set tab STOPS, not spacing.:
but after they’re inserted, can’t you have N++ set to convert to space?
My experiment was:
- create new file tab with Ctrl+n
- execute Pythonscript
editor.clearTabStops(0)
in console - execute Pythonscript
editor.addTabStops(0, 100)
in console - move focus to editor (on line 1 since empty file); press Tab key a few times (observe insertion of four space characters each time)
- go to Preferences, change Default file type setting to not replace with spaces
- move focus back to editor line 1; delete previously entered spaces; press Tab key a few times; observe:
So I do see an effect, but only when tab characters are used. (Another thing to note is that the “indent lines” don’t seem to respect tab stops that are not regular).
Thus I don’t see how to achieve anything with only space characters. Or maybe you had some other idea?
-
@alan-kilborn said in Need to set tab STOPS, not spacing.:
Or maybe you had some other idea?
No, that about sums up my thoughts on the matter :-) Thanks for the testing explanation.
Cheers.