[TxMt] Odd behavior with "Move Selection Line Up" and "Line Down"

Michael Henry macromates at drmikehenry.com
Sun May 21 11:40:01 UTC 2006


All,

I recently purchased TextMate and I've been very impressed with it.  It 
was one of the main reasons I just switched to a mac.

I've been wondering about the behavior of the Text | Move Selection | 
Line Up command.  It works exactly as I'd expect when text is actually 
selected, but when you invoke the command with nothing selected, the 
behavior is a little bit odd.  

When nothing is selected, invoking either "Line Up" or "Line Down" from 
the Text | Move Selection menu will move the current line up or down, 
which is exactly what I'd want it to do.  The unexpected behavior is 
that the cursor doesn't remain on the moved line at the original offset; 
instead, the cursor ends up at the start of the line immediately below 
the moved line.  This makes it difficult to move a given line more than 
one line up or down.

Could this behavior be changed?  For example, in the following five 
lines of text, imagine the cursor is on the "@" character:

  first line
  second line
  third @line
  fourth line
  fifth line

With nothing selected, I'd like to press control-command-up twice and 
end up like this:

  third @line
  first line
  second line
  fourth line
  fifth line

with the cursor still in the same place on the "@" symbol.  With the 
current implementation, pressing control-command-up twice first 
exchanges "second line" and "third line", then exchanges them back, 
leaving my cursor at the start of "third line":

  first line
  second line
  @third line
  fourth line
  fifth line

I like the way that many features in TextMate operate on the selected 
text when a selection is active, but fall back to some natural unit of 
text for the given operation when nothing is selected.  To me, the 
above-described line move operations seem to "line up" with this philosophy.

Thanks,
Michael Henry




More information about the textmate mailing list