MCPcopy Create free account
hub / github.com/cogentcore/core / MapByName

Method MapByName

keymap/keymap.go:277–285  ·  view source on GitHub ↗

MapByName returns a [Map] and index by name. It returns false and prints an error message if not found.

(name MapName)

Source from the content-addressed store, hash-verified

275// MapByName returns a [Map] and index by name. It returns false
276// and prints an error message if not found.
277func (km *Maps) MapByName(name MapName) (*Map, int, bool) {
278 for i, it := range *km {
279 if it.Name == string(name) {
280 return &it.Map, i, true
281 }
282 }
283 slog.Error("keymap.KeyMaps.MapByName: key map not found", "name", name)
284 return nil, -1, false
285}
286
287// CopyFrom copies keymaps from given other map
288func (km *Maps) CopyFrom(cp Maps) {

Callers 2

InitMethod · 0.80
SetActiveMapNameFunction · 0.80

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected