What’s a word in Firefox?

When you’re a coder, you spend a lot of your life looking at things like this:

<?php
$ate_the_donuts = TRUE;
?>

That’s a variable called $ate_the_donuts, and that line of code sets it to equal “true.”

Because coding is often simply about moving bits of code around from place to place in a file by copy-and-paste, frequently there’s a need to select $ate_the_donuts in a text editor, and a really easy way to do that is to double-click on it.

For example, in Sublime Text, the program I use for most of my coding, I can double click on $ate_the_donuts, and the entire variable name gets selected, like this:

This is exactly what I want to happen.

However, often I want to copy code from web pages into my text editor; in a perfect world things would work the same way.

But they don’t.

In Firefox–going back to the very beginning and continuing into the version released last week–double-clicking on the same variable name works differently:

Instead of selecting the entire variable name, Firefox just selects part of it.

This is because the logic in Sublime Text and in Firefox for figuring out “what’s a word” when I double-click is different.

In Sublime Text, an underscore character is considered part of a word.

In Firefox, an underscore character isn’t considered part of a word. And so the select stops when one is encountered.

A bug report on this for Firefox was filed 15 years ago, in March of 2003: underscore should be part of word, not punctuation.

The bug report is still open. There’s been discussion back and forth over the years about how to approach this, but nothing’s ever been implemented.

So I was happy to see a little ripple of activity on the bug yesterday; I agree with the person who updated things: “single behavior annoyance outside of an otherwise great browser experience.”

The nice thing about Firefox is that I can know all about this, and can read the gory details and, if push comes to shove, I can jump into the fray myself and propose a solution. I’m willing to put up with the “behaviour annoyance” to get that open source payoff. This will get fixed. Eventually.

Comments

Peter Rukavina's picture
Peter Rukavina on January 4, 2018 - 14:33 Permalink

This bug has been fixed in Firefox 59, per the ticket. 15 years from start to finish!