on.keychord_press = function(chord, key)
	print('key press', chord)
	if chord == 'C-=' then
		-- zoom in
		Viewport.zoom = Viewport.zoom+0.1
		A()
	elseif chord == 'C--' then
		-- zoom out
		if (Viewport.zoom-0.1)*20 >= 1 then  -- disallow font size of 0
			Viewport.zoom = Viewport.zoom-0.1
			A()
		end
	elseif chord == 'C-0' then
		-- reset zoom
		Viewport.zoom = 1.0
		A()
	elseif chord == 'C-v' then
		-- load new URL
		if Major_version >= 12 then  -- requires LÖVE with https
			-- ignore stuff in the clipboard that doesn't look like a url
			local cb = App.get_clipboard()
			if #cb > 300 then
				print('clipboard: '..cb:sub(1,300)..'...')
			else
				print('clipboard: '..cb)
			end
			if cb:match('^%s*https://[^%s]*%s*$') then
				print('clipboard contains a URL')
				Url = trim(cb)
				load_nodes_from_url()
				set_cursor(ml_from_url(Url).id)
				A()
				ensure_cursor_node_within_viewport()
			end
		end
	elseif chord == 'C-up' then
		if Cursor_node.in_reply_to_id then
			Cursor_node = Nodes[Cursor_node.in_reply_to_id]
			ensure_cursor_node_within_viewport()
		end
	elseif chord == 'C-down' then
		if Cursor_node.children and #Cursor_node.children > 0 then
			Cursor_node = Nodes[Cursor_node.children[1]]
			ensure_cursor_node_within_viewport()
		end
	elseif chord == 'C-left' then
		if Cursor_node.in_reply_to_id then
			local parent = Nodes[Cursor_node.in_reply_to_id]
			assert(parent.children)
			if #parent.children > 1 then
				local idx = array.find(parent.children, Cursor_node.id)
				if idx > 1 then
					Cursor_node = Nodes[parent.children[idx-1]]
					ensure_cursor_node_within_viewport()
				end
			end
		end
	elseif chord == 'C-right' then
		if Cursor_node.in_reply_to_id then
			local parent = Nodes[Cursor_node.in_reply_to_id]
			assert(parent.children)
			if #parent.children > 1 then
				local idx = array.find(parent.children, Cursor_node.id)
				if idx < #parent.children then
					Cursor_node = Nodes[parent.children[idx+1]]
					ensure_cursor_node_within_viewport()
				end
			end
		end
	end
end