diff --git a/gui/buffer.go b/gui/buffer.go index c557a8f..818c539 100644 --- a/gui/buffer.go +++ b/gui/buffer.go @@ -5,6 +5,7 @@ import ( "log" "path" "regexp" + "runtime" "strings" "time" "unicode" @@ -139,6 +140,30 @@ var shiftAlternative = map[rune]rune{ '§': '±', } +var altAlternative = map[rune]rune{ + '1': '¡', + '2': '€', + '3': '#', + '4': '¢', + '5': '∞', + '6': '§', + '7': '¶', + '8': '•', + '9': 'ª', + '0': 'º', + '-': '–', + '=': '≠', + '`': '`', + '/': '÷', + '.': '≥', + ',': '≤', + '[': '“', + ']': '‘', + ';': '…', + '\'': 'æ', + '\\': '«', +} + func (b *Buffer) processTextInput(r rune) bool { if ALT_DOWN && r == '\t' { // nop, we dont want to @@ -147,6 +172,15 @@ func (b *Buffer) processTextInput(r rune) bool { return true } + // only do the alt alternatives on mac osx + // todo change this so it's not checking on every + // input + if runtime.GOOS == "darwin" && ALT_DOWN { + if val, ok := altAlternative[r]; ok { + r = val + } + } + if CAPS_LOCK { if unicode.IsLetter(r) { r = unicode.ToUpper(r)