Skip to main content

Double-click to Select

· One min read

In most programs, you can double click text to select a contiguous block of text. That is, the text between delimiters.

What counts as "contiguous" has a lot of overlap with what is a valid identifier in most programming languages.

Spaces and most punctuation are nearly always treated as delimiters. This means the individual components of a [[PascalCase]] string are treated as a single block. Underscores--which are perhaps logically delimiters--usually extend the block, so [[snake_case]] strings are treated as a single block as well. With some exceptions, the components of a [[kebab-case]] string are treated as individual blocks.

So for example, given the natural language string "foo bar baz quux", the following table shows the final text that would be selected if you double click on the word "bar"

casestringselected substring
natural languagefoo bar baz quuxbar
kebab-casefoo-bar-baz-quuxbar
snake_casefoo_bar_baz_quuxfoo_bar_baz_quux
PascalCaseFooBarBazQuuxFooBarBazQuux

Further Reading

  • [[NamingConventions|Naming Conventions]]