mirror of
https://github.com/felixangell/phi.git
synced 2024-08-16 19:20:21 +03:00
handle option combos on mac
This commit is contained in:
parent
0ac9aff112
commit
0395a358b4
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user