github.com/jmigpin/editor@v1.6.0/core/internalcmds/runecodes.go (about) 1 package internalcmds 2 3 import ( 4 "fmt" 5 6 "github.com/jmigpin/editor/core" 7 ) 8 9 func RuneCodes(args *core.InternalCmdArgs) error { 10 erow := args.ERow 11 12 ta := erow.Row.TextArea 13 b, ok := ta.EditCtx().Selection() 14 if !ok { 15 return fmt.Errorf("no text selected") 16 } 17 18 s := "runecodes:\n" 19 for i, ru := range string(b) { 20 s += fmt.Sprintf("\t%v: %c, %v\n", i, ru, int(ru)) 21 } 22 erow.Ed.Messagef(s) 23 24 return nil 25 }