# xjove (and JoveTool) mouse bindings:
#
# button 1:
#	down, double-click down, triple-click down, drag while 1 down:
#		xj-mouse-point [set point to mouse location]
#	up (any number of clicks):
#		xj-mouse-yank [set point to mouse location; yank if CTRL held]
# button 2:
#	down, drag while 2 down:
#		xj-mouse-mark [set point and mark to mouse location]
#	double-click down:
#		xj-mouse-word [undo preceding mouse-copy-cut; set mark to end of
#			word designated by mouse; set point to start of word]
#	triple-click down:
#		xj-mouse-word [undo preceding mouse-copy-cut; set mark to end of
#			line designated by mouse; set point to start of line]
#	up (any number of clicks):
#		xj-mouse-copy-cut [copy region if CTRL pressed;
#			delete region if CTRL+SHIFT pressed]
# button 3:
#	not available

bind-to-key xj-mouse-point ^Xm0
bind-to-key xj-mouse-point ^Xm1
bind-to-key xj-mouse-point ^Xm2
bind-to-key xj-mouse-yank ^Xm3
bind-to-key xj-mouse-point ^Xm4
bind-to-key xj-mouse-mark ^Xm5
bind-to-key xj-mouse-word ^Xm6
bind-to-key xj-mouse-line ^Xm7
bind-to-key xj-mouse-copy-cut ^Xm8
bind-to-key xj-mouse-point ^Xm9

# The following bindings are designed for the Sun Type 4 Keyboard.

# define macro to display TERMinal-specific keychart file
define-macro keychart ^[xpushlibd^M^U^[xshell-command-with-typeout cat keychart.$TERM^M^[xpopd^M

# For the Type 5 keyboard it so happens that all the extra keys, under the
# default xmodmap, are simply duplicates of other keys on the keyboard (except
# that they still have their effects even when Num Lock is on). So my binding
# still works sensibly, except for the missing KP_Subtract key.

# Note that the files jove.rc.sun and jove.rc.sun-cmd should be identical,
# and preferably hard-linked together.

# The following general principles were followed in designing this binding:
# 1. Groupings of keys that are found in bindings for other terminals
#    should be adhered to so far as possible.
# 2. Keys which do related things should be close together.
# 3. Keys which do certain things under Sun editors (notably textedit)
#    should do the same (or similar) things under jove.
# 4. Keys which have suggestive engravings on them should do what the
#    engravings suggest.
#    Thus KP_0 ("Ins") and KP_Point ("Del") are used to insert and delete
#    lines. Since 9 of the 15 R keys were already associated with cursor
#    movement or scrolling, it seemed right to make the remaining 6 do
#    likewise.

# However, having said all that, these bindings are only illustrative
# suggestions, and local sysadmins may well wish to change them.

# arrow keys, using their xjove bindings
bind-to-key backward-character ^[[217z
bind-to-key previous-line ^[[215z
bind-to-key next-line ^[[221z
bind-to-key forward-character ^[[219z

# L keys
bind-to-key over-write-mode ^[[192z
bind-to-key auto-fill-mode ^[[193z
bind-to-key set-mark ^[[194z
bind-to-key exchange-point-and-mark ^[[195z
bind-to-key copy-region ^[[197z
bind-to-key yank ^[[199z
bind-to-key search-forward ^[[200z
bind-to-key search-reverse ^[^[[200z
bind-to-key kill-region ^[[201z

# Help key (xjove only)
bind-macro-to-key keychart ^[[202z

# F keys
bind-to-key execute-named-command ^[[224z
bind-to-key split-current-window ^[[225z
bind-to-key next-window ^[[226z
bind-to-key delete-other-window ^[[227z
bind-to-key delete-current-window ^[[228z
bind-to-key grow-window ^[[229z
bind-to-key spell-buffer ^[[230z
bind-to-key fill-comment ^[[231z
bind-to-key fill-paragraph ^[[232z
bind-to-key list-buffers ^[[233z
bind-to-key select-buffer ^[[234z
bind-to-key find-file ^[[235z

# On the Type 4 keyboard the Backspace key is right below Delete and, in the
# default Jove bindings these both do delete-previous-character. They would
# make a fine pair with one to delete forward and one to delete backward.
# For historical reasons, we leave them both as delete backward, but
# recommend that the adventurous (or IBM PC acculturated) enable these.
# bind-to-key delete-next-character ^?
# bind-to-key kill-next-word ^[^?

# R keys (these are all associated with cursor movement or scrolling)
bind-to-key beginning-of-line ^[[208z
bind-to-key backward-list ^[[209z
bind-to-key backward-word ^[[210z
bind-to-key end-of-line ^[[211z
bind-to-key forward-list ^[[212z
bind-to-key forward-word ^[[213z
bind-to-key beginning-of-file ^[[214z
bind-to-key previous-page ^[[216z
# This moves the cursor to the start of the next line.
define-macro newline-and-beginning ^A^N
bind-macro-to-key newline-and-beginning ^[[218z
bind-to-key end-of-file ^[[220z
bind-to-key next-page ^[[222z

# The following are only available with xjove.
# KP_0 (engraved "Ins")
bind-to-key newline-and-backup ^[[247z
# KP_Point (engraved "Del")
bind-macro-to-key kill-line ^[[249z
# KP_Enter
bind-to-key shell ^[[250z
# KP_Add
bind-to-key scroll-up ^[[253z
# KP_Subtract
bind-to-key scroll-down ^[[254z

# It is presumed Sun users will normally use xjove. Hence:
set scroll-bar on
