/usr/share/epic4/script/paste is in epic4 1:2.10.6-1build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #
# Here's the plan...
#
# We want a scripted /set paste, when we turn it on, it sends whatever we type
# to the current target. We also need to be able to turn it off automatically
# because we won't be able to type any commands while it's active. We need
# to be able to configure the timeout, and we also want to be able to strip
# any leading whitespace on the lines we paste. (AnguzHawk asked for this
# feature particularly.)
#
@ paste.on = 0
@ paste.strip = 0
@ paste.delay = 30
# Uncomment this if you want a key binding.
bind ^P parse_command { set paste toggle }
# # #
on ^set "paste %" {
xecho -b PASTE is ${paste.on ? [ON] : [OFF]}
xecho -b PASTE_STRIP is ${paste.strip ? [ON] : [OFF]}
xecho -b PASTE_DELAY is $paste.delay
}
on ^set "paste toggle" {
set paste ${paste.on ? [off] : [on]}
}
on ^set "paste on" {
@ paste.on = 1
setup_paste
xecho -b PASTE mode ON -- automatically turns off in $paste.delay seconds.
}
on ^set "paste off" {
@ paste.on = 0
remove_paste
xecho -b PASTE mode OFF
}
# # #
on ^set "paste_strip %" {
xecho -b Usage: /SET PASTE_STRIP [ON|OFF]
}
on ^set "paste_strip toggle" {
set paste_strip ${paste.on ? [off] : [on]}
}
on ^set "paste_strip on" {
@ paste.strip = 1
xecho -b PASTE stripping set to ON
}
on ^set "paste_strip off" {
@ paste.strip = 0
xecho -b PASTE stripping set to OFF
}
# # #
on ^set "paste_delay %" {
if (!isnumber($1) || [$1] <= 0) {
xecho -b Usage: /SET PASTE_DELAY seconds
} {
@ paste.delay = [$1]
xecho -b PASTE_DELAY set to $paste.delay seconds.
}
}
# # #
alias setup_paste
{
stack push bind ^I
bind ^I self_insert
stack push on input
on input -
on ^input * {
if (paste.strip) {
//send $0 $1-
} else {
//send $*
}
}
timer -refnum PASTEOFF $paste.delay set paste off
}
# The 'defer' is for epic clients before epic4-1.1.8
alias remove_paste
{
on input -*
stack pop on input
stack pop bind ^I
defer ^timer -delete PASTEOFF
}
#hop'y2k3
|