⌘F
Find

Script key: Find

Posted by hiro

Install

Details

Label ⌘F
Voice Over Find
Script
// Find text of current line from beginning of document, or find selected text in following sentences.
// カレント行のテキストでメモの先頭から検索、または選択中のテキストで後続の文章を検索

var search_term, search_index, line_range, match, length;

if ( isSelect() === true ) {
  search_term = getSelectedText();
  search_index = getSelectedRange()[0] + 1;
} else {
  line_range = getSelectedLineRange();
  search_term = getTextInRange( line_range[0], line_range[1] );
  search_index = 0;
}
search_term = search_term.replace( /\r?\n/g, '' );
match = getText().indexOf( search_term, search_index );
length = search_term.length;
setSelectedRange( match, length );

function isSelect() {
  if ( getSelectedText().length > 0 ) {
    return true;
  } else {
    return false;
  }
}

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus