#@+leo-ver=4
#@+node:@file arrows.py
"""Rebind up/down arrow keys"""

from leoPlugins import *
from leoGlobals import *

#@+others
#@+node:onOpen
# Warning: the bindings created this way conflict with shift-arrow keys.

def onOpen (tag,keywords):

	c = keywords.get("new_c")
	body = c.frame.body
	tree = c.frame.tree

	# Add "hard" bindings to have up/down arrows move by visual lines.
	old_binding = body.bind("<Up>")
	if len(old_binding) == 0:
		body.bind("<Up>",tree.OnUpKey)

	old_binding = body.bind("<Down>")
	if len(old_binding) == 0:
		body.bind("<Down>",tree.OnDownKey)
#@-node:onOpen
#@-others

if 0: # Register the handlers...
	registerHandler("open2", onOpen)
	
	__version__ = "1.2" # Set version for the plugin handler.
	plugin_signon(__name__)
#@-node:@file arrows.py
#@-leo
