Gordon P. Hemsley

Linguist by day. Web developer by night.

Archive for March, 2009

Real Tab Support in Bespin, Part 2

Posted by Gordon P. Hemsley on March 21, 2009

A couple of days ago, I blogged about trying to add real tab support into Bespin, and about the discussion going on about where that code should live. However, I can now report that, not only have I been successful in my endeavors (again, if you count my first attempt), I have been able to accomplish it solely within the Cursor Manager. This means that I have gone against what I had originally argued for, and I did it by simply starting over.

My first few attempts helped me get familiar with the code that controls the model, the cursor, and the editor. (MVC, as Ben referred to it. But no, not that MVC.) But attempting to switch between model-awareness and cursor-awareness just cluttered up my code and confused the heck out of me. So I saved everything I had in a little patch file, then reverted all my changes and began anew. (Having Ben first commit some basic cleanup stuff I came across certainly helped to clear things, too.)

So I approached the problem logically, with none of the conceptions from my prior attempts, other than my new-found familiarity with the code. This allowed me to focus on the one task that I had: keep everything in cursor. It also helped prevent me from having dozens of search windows up trying to figure out where things were. And, after a bit of minor confusion about object state persistence and object cloning (thanks, kdangoor!), it was done pretty quickly. But it does require that any position coordinates that are sent to the model be translated via the new getModelPosition().

Since Julian Viereck has been “messing around” with “my” code a lot lately, and since this darn task has taken up a good chunk of my day every day this past week and a half, I decided to put up my own public clone of the Bespin repository on BitBucket to keep things running smoothly. That way I can mess around with things, too, and not get in other people’s way (as much). My code for the tab support is available in this changeset, in addition to this attachment on the bug.

So go merge or import or whatever it is you do in Hg, and give my code a whirl. If you find anything amiss, don’t hesitate to let me know. I would imagine Ben will be critiquing my code at some point soon and then eventually getting it into the main source. Enjoy!

Posted in Mozilla, Open Source | Tagged: , , , , , , , , , , , , , , , , , , , | 1 Comment »

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.

Posted in Mozilla | Tagged: , , , , , , , , , , , , , , | 1 Comment »

Writing an Extension for Tab Sets

Posted by Gordon P. Hemsley on March 7, 2009

So, lately, I’ve been having problems with running Firefox 3.0.x on my MacBook Pro (which, admittedly, has been causing me many, many problems in the past couple of months unrelated to Firefox) in terms of speed and response time and whatnot. I’ve fairly certain it has something to do with the number of tabs I have open (which usually falls within the range of 75–100 tabs in my main window, plus a couple of other windows with fewer). However, running even more tabs (115+) on the latest Firefox 3.1b3 candidate build (build 2, as previously mentioned) doesn’t give me nearly as many problems. In fact, I think any problems it does give me are a result of Firefox 3.0.x slowing down my computer and confusing 3.1b3 into think it’s the one to blame.

But anyway, that’s beside the point. The point is, because of this large number of tabs, I’ve been looking to splitting them up into multiple windows. The thing is, if the computer’s not being slowed to a halt, I still have plenty of trouble finding the tabs that I want. It’s no fun having to scroll through 100 tabs to find what you’re looking for, after all.

So, I came up with the idea of writing an extension to have some way of managing what window is for what tasks (i.e. giving them names). Unfortunately (or fortunately, as it often saves me trouble), like every other idea I’ve thought of, someone has already created an extension that does what I’m looking for. This time, it was FireTitle.

The difference in this case, though, is that I’m not quite sure it’s tailored to fit exactly what I want to use it for. In fact, there are a number of problems with it:

  1. It doesn’t work with Firefox 3.1 (or, at least, hasn’t been tested for it).
  2. It only seems to get updated whenever a new version of Firefox comes out (i.e. it’s only been updated 3 times since it was created for Firefox 1.0).
  3. It doesn’t put the name of the tab set in the window title bar, only in the Window menu.
  4. It has a couple of other features I’m not interested in.
  5. It doesn’t save the information across sessions, a feature that was introduced in Firefox 2. (This is especially important, because I work continuously on the same set of tabs, independent of whether Firefox had to close for some reason. I don’t want to have to rename them every time I restart Firefox.)

On the flip-side of that, I’ve been wanting to write an extension for Firefox, but I haven’t had any good ideas to do it with. (Like I said, every time I come up with an idea, someone’s already beaten me to the punch.) So I think I just may go ahead with this idea. Or, at least, I’ll try to. I mean, I have a lot of stuff to do. But this should be useful for me, so that should drive me to do it. Another problem, besides time, would be learning how to do all the fancy code work. I’m a PHP coder, and I haven’t had sufficient experience with JavaScript to know everything by heart. Your help will be appreciated as I blog about it along the way.

I haven’t yet decided what I’ll call it, but it will be based around the concept of “tab sets”. As the term implies, these are sets of tabs group together by a common purpose. This might include “Firefox development” or “Fixing bug 487625” (a completely random number, as it were). This common purpose will also be reflected in the name of the tab set. (In these cases, they’d likely be identical.) So now on to the features:

  • As previously mentioned, named tab sets, possibly with more lengthy descriptions available somewhere.
  • Prepend tab set name to window title (which is followed by the browser branding on Windows, but not Mac; not sure about Linux)
    • Keep normal page title of frontmost tab of each window involved
  • Include number of tabs in the window title bar
    • Eliminates the need for the Tab Counter extension
  • Allow bookmark sets (folders) to be opened as a named window/tab set
  • Perhaps create a status bar button that would open (pop up) to give a list or thumbnails to bring a different tab set into focus (à la most multiple desktops applications). I’m imagining this in the lower left corner of the browser, by the way.

That’s all I’ve come up with so far. I haven’t yet started working on anything. I first have to look into the heart of FireTitle and see how they do it. Also, I don’t know quite how the features go across Firefox versions, but I’m going to be aiming this primarily for Firefox 3.1 (or, 3.5… grr…). If it turns out that’s not a big hassle to include Firefox 3.0 support, then I’ll do that, too.

If you have any questions, comments, suggestions, or answers regarding anything I’ve mentioned here, please comment. I’m looking for any and all feedback I can get.

Posted in Mozilla | Tagged: , , , , , , , , , , , | Leave a Comment »

Working on the Cloud

Posted by Gordon P. Hemsley on March 6, 2009

This is just a quick post to note that I have recently been working with the lovely folks in #bespin (including Dion Almaer [dalmaer]) and helping them out with some minor stuff. I’ve filed a few bugs (namely, bug 481486, bug 481511, and bug 478610) and fixed another (bug 478446). The first bug was a quick fix regarding logging in, and was pushed live to bespin.mozilla.com rather quickly in the form of version 0.1.5 (“Nonchalant Nimbus+”). The second bug was actually fixed by another bug, which also fixed a number of bugs I’d noticed and mentioned in the channel, but never officially filed. The third bug still exists, but is probably still over my head, as it requires removing the display of lines in the area where the scrollbars would/should be. And that fourth bug was a quick regular expression fix to add support for plus signs and underscores in the e-mail addresses used to register on a Bespin implementation. The second and fourth bugs are currently only fixed in trunk, and I don’t know what the plan is for pushing them live. The third bug has yet to be fixed.

I’ve also taken the liberty (with dalmaer’s blessing) of porting Bespin’s README.txt file to MozillaWiki as the starting point for the Developer Guide (which was mentioned in the User Guide as an upcoming document). Work still needs to be done to move any relevant content from the User Guide to the Developer Guide, but I’m heading to bed, because I’ve got a plane to catch for home tomorrow afternoon. (Your help in the matter would be greatly appreciated, though!)

I do want to note first, however, that throughout all this I’ve been implicitly testing QA build 2 of Firefox 3.1b3 (to be released next week), and everything seems tip-top at the moment (with 126 tabs open, no less!).

Posted in Mozilla | Tagged: , , , , , , , , , , , , , , , | 1 Comment »