select next line

Script key: select next line

Posted by Xor

Install

Details

Label
Voice Over select next line
Script
var text = getText()
var n = text.length
var selRange = getSelectedRange()

var p = selRange[0]
var q = p + selRange[1]

selectLine()
if (q < n) {
  p = q + 1
  ++q
  
  selectLine()
  setSelectedRange(p, q - p)
}

function selectLine() {
  var i = p
  var delim = /^[\n]$/
  
  while (i > 0) {
    if (delim.test(text[i - 1]))
      break
  
    --i
  }
  
  var j = q
  
  while (j < n) {
    if (delim.test(text[j]))
      break
    ++j
  }

  //++j
  
  //if (j-i)
  //  setSelectedRange(i, j-i)
  p = i
  q = j
}

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus