Real Tab Support in Bespin
Posted by Gordon P. Hemsley on March 18, 2009
Over the past week, I have been attempting to add real tab support to Bespin (bug 474055), under the guidance of Ben Galbraith (bgalbraith). Discussion on this issue has ensued in many places, including on Ben’s blog (in which he indirectly called me a weird hippie), as well as in at least two topics on the Google Group/mailing list Bespin Core.
The issue behind supporting real tabs is getting the editor to know that a tab is a variable width character. I was able to solve the problem of calculating just how wide that character is supposed to be, but that turned out to be the easy part. The problem that I’ve/we’ve been having is whether to contain all that knowledge in the cursor code (since it is essentially only a display issue) or to allow it to seep into the model code (which does all the actual text manipulation). That discussion is still ongoing right now, but either way, the change would require a little bit of refactoring of a lot of different functions, so that we can keep track of whether the function is getting the cursor position or the model position (as the latter is really just the nth index in the array, with all characters being equal).
So that’s where I’m at now. I’ve tagged the bug with the “student-project” keyword, since I’m a student and I’m working on the project, and I’ve posted a couple of patches in the bug to track my progress (the first one actually works, for the most part; the second one, not so much). All suggestions welcome.