=-
==== / ----

Script key: ==== / —-

Posted by Med0paW

Install

Details

Label =-
Voice Over ==== / ----
Script
// Script keys run short Javascripts
// For documentation and examples, visit:
// http://help.agiletortoise.com

var range = getSelectedRange();
var pos = range[0];
var len = range[1];
var t = getText();
var pre = t.slice(0, pos);
var suf = t.slice(pos + len);
var sep = '\n====\n';
var alt_sep = '\n----\n';

var new_text, new_pos;
if (len == 0 && pre.slice(-sep.length) == sep) {
  new_text = pre.slice(0, -sep.length) + alt_sep + suf;
  new_pos = pre.length;
} else {
  new_text = pre + sep + suf;
  new_pos = (pre + sep).length;
}
setText(new_text);
setSelectedRange(new_pos, 0);

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus