about summary refs log tree commit diff stats
path: root/makefile
Commit message (Expand)AuthorAgeFilesLines
* 2002Kartik K. Agaram2015-08-141-28/+7
* 2001Kartik K. Agaram2015-08-141-27/+31
* 1998Kartik K. Agaram2015-08-141-2/+11
* 1990 - extra ingredient for 'trace' depthKartik K. Agaram2015-08-131-1/+1
* 1976 - fix 'make test'Kartik K. Agaram2015-08-111-2/+2
* 1878 - switch test_all_layers to optimized binariesKartik K. Agaram2015-07-281-1/+1
* 1842 - get layers building again after 2 weeksKartik K. Agaram2015-07-241-4/+4
* 1794 - stop redundantly recompiling on .mu changesKartik K. Agaram2015-07-161-2/+6
* 1706 - automatically recompile mu when necessaryKartik K. Agaram2015-07-041-9/+9
* 1659 - still a little sluggishKartik K. Agaram2015-06-251-1/+1
* 1619Kartik K. Agaram2015-06-221-1/+1
* 1573Kartik K. Agaram2015-06-161-1/+1
* 1439 - support clang in addition to gccKartik K. Agaram2015-05-231-1/+1
* 1424 - the right way to make autogenerated_listsKartik K. Agaram2015-05-221-1/+2
* 1405Kartik K. Agaram2015-05-191-1/+7
* 1404 - undefined-behavior checks using clangKartik K. Agaram2015-05-181-2/+5
* 1403Kartik K. Agaram2015-05-181-7/+6
* 1276 - make C++ version the defaultKartik K. Agaram2015-05-051-0/+52
light .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import curses.ascii
from string import ascii_lowercase

def parse_keybinding(obj):
	"""
	Translate a keybinding to a sequence of integers

	Example:
	lol<CR>   =>   (108, 111, 108, 10)
	"""
	assert isinstance(obj, (tuple, int, str))
	if isinstance(obj, tuple):
		for char in obj:
			yield char
	elif isinstance(obj, int):
		yield obj
	elif isinstance(obj, str):
		in_brackets = False
		bracket_content = None
		for char in obj:
			if in_brackets:
				if char == '>':
					in_brackets = False
					string = ''.join(bracket_content).lower()
					try:
						keys = special_keys[string]
						for key in keys:
							yield key
					except KeyError:
						yield ord('<')
						for c in bracket_content:
							yield ord(c)
						yield ord('>')
					except TypeError:
						yield keys  # it was no tuple, just an int
				else:
					bracket_content.append(char)
			else:
				if char == '<':
					in_brackets = True
					bracket_content = []
				else:
					yield ord(char)
		if in_brackets:
			yield ord('<')
			for c in bracket_content:
				yield ord(c)

# Arbitrary numbers which are not used with curses.KEY_XYZ
DIRKEY = 9001
ANYKEY = 9002
PASSIVE_ACTION = 9003

special_keys = {
	'dir': DIRKEY,
	'any': ANYKEY,
	'bg': PASSIVE_ACTION,
	'backspace': curses.KEY_BACKSPACE,
	'backspace2': curses.ascii.DEL,
	'delete': curses.KEY_DC,
	'cr': ord("\n"),
	'enter': ord("\n"),
	'space': ord(" "),
	'esc': curses.ascii.ESC,
	'down': curses.KEY_DOWN,
	'up': curses.KEY_UP,
	'left': curses.KEY_LEFT,
	'right': curses.KEY_RIGHT,
	'pagedown': curses.KEY_NPAGE,
	'pageup': curses.KEY_PPAGE,
	'home': curses.KEY_HOME,
	'end': curses.KEY_END,
	'tab': ord('\t'),
	's-tab': curses.KEY_BTAB,
}

for char in ascii_lowercase:
	special_keys['c-' + char] = ord(char) - 96

for char in (ascii_lowercase + '0123456789'):
	special_keys['a-' + char] = (27, ord(char))

for n in range(64):
	special_keys['f' + str(n)] = curses.KEY_F0 + n