Home Download Buy Blog Forum Support

elastic tabs

Re: elastic tabs

Postby tobia on Fri May 10, 2013 9:28 pm

adzenith wrote:Unfortunately there's no way to get it to work with a proportional font: the API doesn't allow either determining character width or inserting arbitrary-width spaces.

Does it tell you what tab stop you're at? Meaning which visual tab stop a given tab character is aligned to? If it does, then you could have an option to insert consecutive tabs to fake the elastic tabstops, instead of spaces. So that the plugin would only have to change the number of consecutive tab characters to keep the columns aligned. It would sometimes waste a bit of space, as in this example, but it would not be too bad.
Screen Shot 2013-05-10 at 22.50.57.png
Screen Shot 2013-05-10 at 22.50.57.png (21.5 KiB) Viewed 1163 times
Posts: 12
Joined: Tue Oct 16, 2012 2:55 pm

Re: elastic tabs

Postby adzenith on Sat May 11, 2013 7:28 pm

No, there's no way to find out what tabstop you're at. Scenarios like this are difficult:
iiiii ⇥ ⇥
mm ⇥

The tabs are being translated to single spaces by the forum software, unfortunately, but five i's need two tabs, and two m's need one tab, and there's no way to figure that out using the Sublime API -- you'd have to figure out what font is being used and do the math yourself.
Posts: 1341
Joined: Mon Oct 19, 2009 9:12 pm

Re: elastic tabs

Postby adzenith on Wed Jun 19, 2013 9:15 pm

Support for ST3 has been added! Woo!
Thanks to lunixbochs for the edit abstraction.
Posts: 1341
Joined: Mon Oct 19, 2009 9:12 pm

Re: elastic tabs

Postby stoneym on Fri Jul 12, 2013 8:41 am

This would be much better if implemented as the inventor intended. The use of spaces as padding completely destroys the concept, and the original purpose of being able to code with a proportional font and still have your indents line up.

I agree with the inventor. We should be using spaces and tabs semantically. Spaces to separate keywords and tabs to indent code. Nothing else. Nada.

I would love if Sublime Text would implement this natively. It would have to to ever work properly. The changes necessary to the rendering engine for a plugin to handle this would be the same changes necessary for the editor to just do it. It could be an optional rendering mode and quite honestly should be fairly trivial to implement. There needs to be no counting or trickery, etc. You don't need defined widths for tabstops anymore and you don't need to define them at all really. You don't have to care about font sizes or weights or kerning or anything. You only need to be able to detect if you have made all the text in a "column" visible. Here is the best example I can think of to explain the implementation that I would want.

Imagine that you were using Microsoft Excel or Libre Office/Open Office Calc with no grid lines visible. A nice blank canvas. Now imaging there is an option for columns to autosize themselves to the longest text in the column as you type. Anytime you hit tab it would simply take you to the next column in that row. When you hit enter it takes you to the next row and puts you in the first column that has data in the previous row. If the previous row has no text it plops you in the first column.

That is a proper elastic tabstops implementation. Until editors stop counting spaces and/or tabs and depending on monospaced fonts we won't ever be out of this formatting mess when we try to look at some other group's or individual's code. If most major editors adhered to the elastic standard all code, monospace or proportional font, would be a lot easier to read and a lot more portable.

As an aside, and an alternate solution to the problem, I offer up the Gupta SQL Windows editor. It was a love it or hate it, definitely no in between, proposition. It was formatted as an outline. Everything treated like nested bullet points in word are, only it worked better. You never had to worry about tab width, spaces instead of tabs, tab stops, etc. Control flow was handled by indentation. For me it is still the best editor I ever used. It made life a lot easier when picking up the moron's code from the cube next to you. It made certain things very clear and kept newbies from shooting themselves in the foot. I still do some maintenance work from time to time for old customers and I always enjoy working in this editor again. I am probably alone but I would prefer this even over elastic tabs. A modern and updated implementation that is.

Posts: 1
Joined: Sat Jun 29, 2013 6:15 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 5 guests