From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Fri, 29 Apr 2011 09:56:53 -0700 From: Bakul Shah Message-Id: <20110429165653.1CB9CB827@mail.bitblocks.com> Subject: [9fans] An acme question Topicbox-Message-UUID: d90d358c-ead6-11e9-9d60-3106f5b1d025 Here's something for a brief respite from linux bashing.... In acme, at present a single click positions the cursor, a double click selects either the word under the cursor or the entire line, depending on the cursor position. What I would like to do is to the change logic as follows: If you double *on* a word, the word is selected. If you double click on white space or a bracket, a whole block is selected, where a block is defined by matching brackets -- (), {} or []. This property should be settable on a per window basis. Example: given { fee [({ foo bar}) [and so on]] } 1 2 3456 7 Double clicking at 1 selects foo, at 2 or 3 selects the phrase { foo bar}, at 4 selects the phrase ({ foo bar}), at 5 selects the phrase [({ foo bar}) [and so on]], at 6 selects the phrase [and so on], at 7 selects the entire { fee [({ foo bar}) [and so on]] } etc. Note: a block need not fit on one line. A further enhancement: doubleclicking in a selected block expands the selection to the surrounding block, without moving the cursor. Is this doable or too painful? I took a quick look but couldn't immediately see how. If doable, how would I go about it? I was thinking of keeping a list of matched string pairs (REs might be too powerful) and look for one of left strings earlier in the file. When one is found, look for the matching right string later in the file. If none found, select to the very end. Surely someone has already tried this? Thanks, --bakul