diff --git a/base/fileinfo/fileinfo.go b/base/fileinfo/fileinfo.go index e1cc2cf148..96ba2e2f3d 100644 --- a/base/fileinfo/fileinfo.go +++ b/base/fileinfo/fileinfo.go @@ -161,7 +161,7 @@ func (fi *FileInfo) SetType(ftyp Known) { mt := MimeFromKnown(ftyp) fi.Mime = mt.Mime fi.Cat = mt.Cat - fi.Known = mt.Sup + fi.Known = mt.Known if fi.Name == "" && len(mt.Exts) > 0 { fi.Name = "_fake" + mt.Exts[0] fi.Path = fi.Name diff --git a/base/fileinfo/mimetype.go b/base/fileinfo/mimetype.go index 1884550aa4..d44bcc819f 100644 --- a/base/fileinfo/mimetype.go +++ b/base/fileinfo/mimetype.go @@ -139,7 +139,7 @@ type MimeType struct { Cat Categories // if known, the name of the known file type, else NoSupporUnknown - Sup Known + Known Known } // CustomMimes can be set by other apps to contain custom mime types that @@ -158,7 +158,7 @@ func MimeKnown(mime string) Known { if !has { return Unknown } - return mt.Sup + return mt.Known } // ExtKnown returns the known type for given file extension, @@ -172,7 +172,7 @@ func ExtKnown(ext string) Known { if !has { return Unknown } - return mt.Sup + return mt.Known } // KnownFromFile returns the known type for given file, @@ -188,7 +188,7 @@ func KnownFromFile(fname string) Known { // MimeFromKnown returns MimeType info for given known file type. func MimeFromKnown(ftyp Known) MimeType { for _, mt := range AvailableMimes { - if mt.Sup == ftyp { + if mt.Known == ftyp { return mt } } @@ -223,20 +223,20 @@ func MergeAvailableMimes() { ExtMimeMap[ex] = mt.Mime } } - if mt.Sup != Unknown { - if hsp, has := KnownMimes[mt.Sup]; has { - fmt.Printf("fileinfo.MergeAvailMimes: more-than-one mimetype has extensions for same known file type: %v -- one: %v other %v\n", mt.Sup, hsp.Mime, mt.Mime) + if mt.Known != Unknown { + if hsp, has := KnownMimes[mt.Known]; has { + fmt.Printf("fileinfo.MergeAvailMimes: more-than-one mimetype has extensions for same known file type: %v -- one: %v other %v\n", mt.Known, hsp.Mime, mt.Mime) } else { - KnownMimes[mt.Sup] = mt + KnownMimes[mt.Known] = mt } } } } // second pass to get any known guys that don't have exts for _, mt := range AvailableMimes { - if mt.Sup != Unknown { - if _, has := KnownMimes[mt.Sup]; !has { - KnownMimes[mt.Sup] = mt + if mt.Known != Unknown { + if _, has := KnownMimes[mt.Known]; !has { + KnownMimes[mt.Known] = mt } } } diff --git a/parse/filestates.go b/parse/filestates.go index 5702eb10ff..a71869a40b 100644 --- a/parse/filestates.go +++ b/parse/filestates.go @@ -20,7 +20,7 @@ type FileStates struct { Filename string // the known file type, if known (typically only known files are processed) - Sup fileinfo.Known + Known fileinfo.Known // base path for reporting file names -- this must be set externally e.g., by gide for the project root path BasePath string @@ -62,7 +62,7 @@ func (fs *FileStates) SetSrc(fname, basepath string, sup fileinfo.Known) { fs.Filename = fname fs.BasePath = basepath - fs.Sup = sup + fs.Known = sup fs.FsA.SetSrc(nil, fname, basepath, sup) fs.FsB.SetSrc(nil, fname, basepath, sup) diff --git a/parse/languages/golang/complete.go b/parse/languages/golang/complete.go index f59f29f7bb..861db2932f 100644 --- a/parse/languages/golang/complete.go +++ b/parse/languages/golang/complete.go @@ -50,7 +50,7 @@ func (gl *GoLang) Lookup(fss *parse.FileStates, str string, pos lexer.Pos) (ld c if CompleteTrace { fmt.Printf("lookup str: %v orig: %v\n", str, origStr) } - lfs := pr.ParseString(str, fpath, fs.Src.Sup) + lfs := pr.ParseString(str, fpath, fs.Src.Known) if lfs == nil { return } @@ -160,7 +160,7 @@ func (gl *GoLang) CompleteLine(fss *parse.FileStates, str string, pos lexer.Pos) if CompleteTrace { fmt.Printf("complete str: %v orig: %v\n", str, origStr) } - lfs := pr.ParseString(str, fpath, fs.Src.Sup) + lfs := pr.ParseString(str, fpath, fs.Src.Known) if lfs == nil { return } diff --git a/parse/lexer/file.go b/parse/lexer/file.go index d06a5fa8f4..5078ce73a2 100644 --- a/parse/lexer/file.go +++ b/parse/lexer/file.go @@ -25,7 +25,7 @@ type File struct { Filename string // the known file type, if known (typically only known files are processed) - Sup fileinfo.Known + Known fileinfo.Known // base path for reporting file names -- this must be set externally e.g., by gide for the project root path BasePath string @@ -48,12 +48,12 @@ type File struct { // SetSrc sets the source to given content, and alloc Lexs -- if basepath is empty // then it is set to the path for the filename -func (fl *File) SetSrc(src [][]rune, fname, basepath string, sup fileinfo.Known) { +func (fl *File) SetSrc(src [][]rune, fname, basepath string, known fileinfo.Known) { fl.Filename = fname if basepath != "" { fl.BasePath = basepath } - fl.Sup = sup + fl.Known = known fl.Lines = src fl.AllocLines() } @@ -141,8 +141,8 @@ func (fl *File) OpenFile(fname string) error { return err } rns := RunesFromBytes(alltxt) - sup := fileinfo.KnownFromFile(fname) - fl.SetSrc(rns, fname, "", sup) + known := fileinfo.KnownFromFile(fname) + fl.SetSrc(rns, fname, "", known) return nil } @@ -173,7 +173,7 @@ func (fl *File) InitFromLine(sfl *File, ln int) bool { return false } src := [][]rune{sfl.Lines[ln], {}} // need extra blank - fl.SetSrc(src, sfl.Filename, sfl.BasePath, sfl.Sup) + fl.SetSrc(src, sfl.Filename, sfl.BasePath, sfl.Known) fl.Lexs = []Line{sfl.Lexs[ln], {}} fl.Comments = []Line{sfl.Comments[ln], {}} fl.EosPos = []EosPos{sfl.EosPos[ln], {}} @@ -181,7 +181,7 @@ func (fl *File) InitFromLine(sfl *File, ln int) bool { } // InitFromString initializes from given string. Returns false if string is empty -func (fl *File) InitFromString(str string, fname string, sup fileinfo.Known) bool { +func (fl *File) InitFromString(str string, fname string, known fileinfo.Known) bool { if str == "" { return false } @@ -189,7 +189,7 @@ func (fl *File) InitFromString(str string, fname string, sup fileinfo.Known) boo if len(src) == 1 { // need more than 1 line src = append(src, []rune{}) } - fl.SetSrc(src, fname, "", sup) + fl.SetSrc(src, fname, "", known) return true } diff --git a/shell/interpreter/cogentcore_org-core-base-stringsx.go b/shell/interpreter/cogentcore_org-core-base-stringsx.go index 51f637a477..f4f77cf0e5 100644 --- a/shell/interpreter/cogentcore_org-core-base-stringsx.go +++ b/shell/interpreter/cogentcore_org-core-base-stringsx.go @@ -10,7 +10,10 @@ import ( func init() { Symbols["cogentcore.org/core/base/stringsx/stringsx"] = map[string]reflect.Value{ // function, constant and variable definitions + "ByteSplitLines": reflect.ValueOf(stringsx.ByteSplitLines), + "ByteTrimCR": reflect.ValueOf(stringsx.ByteTrimCR), "InsertFirstUnique": reflect.ValueOf(stringsx.InsertFirstUnique), "SplitLines": reflect.ValueOf(stringsx.SplitLines), + "TrimCR": reflect.ValueOf(stringsx.TrimCR), } } diff --git a/shell/interpreter/make b/shell/interpreter/make index ef058e94c6..da045d6d28 100755 --- a/shell/interpreter/make +++ b/shell/interpreter/make @@ -11,5 +11,7 @@ command cosh { yaegi extract cogentcore.org/core/shell/cosh } -shell.RunCommands(args) +// shell.RunCommands(args) +base +cosh diff --git a/texteditor/complete.go b/texteditor/complete.go index 47efbc9181..23933e7d19 100644 --- a/texteditor/complete.go +++ b/texteditor/complete.go @@ -23,7 +23,7 @@ func completeParse(data any, text string, posLine, posChar int) (md complete.Mat // log.Printf("CompletePi: data is nil not FileStates or is nil - can't complete\n") return md } - lp, err := parse.LanguageSupport.Properties(sfs.Sup) + lp, err := parse.LanguageSupport.Properties(sfs.Known) if err != nil { // log.Printf("CompletePi: %v\n", err) return md @@ -47,7 +47,7 @@ func completeEditParse(data any, text string, cursorPos int, comp complete.Compl // log.Printf("CompleteEditPi: data is nil not FileStates or is nil - can't complete\n") return ed } - lp, err := parse.LanguageSupport.Properties(sfs.Sup) + lp, err := parse.LanguageSupport.Properties(sfs.Known) if err != nil { // log.Printf("CompleteEditPi: %v\n", err) return ed @@ -67,7 +67,7 @@ func lookupParse(data any, text string, posLine, posChar int) (ld complete.Looku // log.Printf("LookupPi: data is nil not FileStates or is nil - can't lookup\n") return ld } - lp, err := parse.LanguageSupport.Properties(sfs.Sup) + lp, err := parse.LanguageSupport.Properties(sfs.Known) if err != nil { // log.Printf("LookupPi: %v\n", err) return ld diff --git a/texteditor/events.go b/texteditor/events.go index b47be118a3..efc314c3eb 100644 --- a/texteditor/events.go +++ b/texteditor/events.go @@ -328,7 +328,7 @@ func (ed *Editor) keyInput(e events.Event) { if !e.HasAnyModifier(key.Control, key.Meta) { e.SetHandled() if ed.Buffer.Options.AutoIndent { - lp, _ := parse.LanguageSupport.Properties(ed.Buffer.ParseState.Sup) + lp, _ := parse.LanguageSupport.Properties(ed.Buffer.ParseState.Known) if lp != nil && lp.Lang != nil && lp.HasFlag(parse.ReAutoIndent) { // only re-indent current line for supported types tbe, _, _ := ed.Buffer.AutoIndent(ed.CursorPos.Ln) // reindent current line @@ -399,7 +399,7 @@ func (ed *Editor) keyInputInsertBracket(kt events.Event) { newLine := false curLn := ed.Buffer.Line(pos.Ln) lnLen := len(curLn) - lp, _ := parse.LanguageSupport.Properties(ed.Buffer.ParseState.Sup) + lp, _ := parse.LanguageSupport.Properties(ed.Buffer.ParseState.Known) if lp != nil && lp.Lang != nil { match, newLine = lp.Lang.AutoBracket(&ed.Buffer.ParseState, kt.KeyRune(), pos, curLn) } else { diff --git a/texteditor/textbuf/lines.go b/texteditor/textbuf/lines.go index 690ea4ada5..2d70240a41 100644 --- a/texteditor/textbuf/lines.go +++ b/texteditor/textbuf/lines.go @@ -1548,7 +1548,7 @@ func (ls *Lines) indentLine(ln, ind int) *Edit { // level and character position for the indent of the current line. func (ls *Lines) autoIndent(ln int) (tbe *Edit, indLev, chPos int) { tabSz := ls.Options.TabSize - lp, _ := parse.LanguageSupport.Properties(ls.ParseState.Sup) + lp, _ := parse.LanguageSupport.Properties(ls.ParseState.Known) var pInd, delInd int if lp != nil && lp.Lang != nil { pInd, delInd, _, _ = lp.Lang.IndentLine(&ls.ParseState, ls.lines, ls.hiTags, ln, tabSz) diff --git a/yaegicore/symbols/cogentcore_org-core-icons.go b/yaegicore/symbols/cogentcore_org-core-icons.go index d757b6619c..5df0e73509 100644 --- a/yaegicore/symbols/cogentcore_org-core-icons.go +++ b/yaegicore/symbols/cogentcore_org-core-icons.go @@ -4,8 +4,6 @@ package symbols import ( "cogentcore.org/core/icons" - "go/constant" - "go/token" "reflect" ) @@ -976,7 +974,6 @@ func init() { "DecimalIncreaseFill": reflect.ValueOf(&icons.DecimalIncreaseFill).Elem(), "Deck": reflect.ValueOf(&icons.Deck).Elem(), "DeckFill": reflect.ValueOf(&icons.DeckFill).Elem(), - "DefaultAppIcon": reflect.ValueOf(constant.MakeFromLiteral("\"\"", token.STRING, 0)), "Dehaze": reflect.ValueOf(&icons.Dehaze).Elem(), "DehazeFill": reflect.ValueOf(&icons.DehazeFill).Elem(), "Delete": reflect.ValueOf(&icons.Delete).Elem(),