当前位置: 首页>>代码示例>>Golang>>正文


Golang backend.GetEditor函数代码示例

本文整理汇总了Golang中github.com/limetext/lime/backend.GetEditor函数的典型用法代码示例。如果您正苦于以下问题:Golang GetEditor函数的具体用法?Golang GetEditor怎么用?Golang GetEditor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetEditor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: sublime_RunCommand

func sublime_RunCommand(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
		arg2 backend.Args
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.Editor.RunCommand() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	arg2 = make(backend.Args)
	if v, err := tu.GetItem(1); err == nil {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(backend.Args); !ok {
				return nil, fmt.Errorf("Expected type backend.Args for backend.Editor.RunCommand() arg2, not %s", v.Type())
			} else {
				arg2 = v2
			}
		}
	}
	backend.GetEditor().RunCommand(arg1, arg2)
	return toPython(nil)
}
开发者ID:jordonbiondo,项目名称:lime,代码行数:33,代码来源:sublime_api_generated.go

示例2: Py_run_command

func (o *View) Py_run_command(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
		arg2 backend.Args
	)
	v, err := tu.GetItem(0)
	if err != nil {
		return nil, err
	}
	if v2, ok := v.(*py.Unicode); !ok {
		return nil, fmt.Errorf("Expected type *py.Unicode for backend.View.RunCommand() arg1, not %s", v.Type())
	} else {
		arg1 = v2.String()
	}
	arg2 = make(backend.Args)
	if v, err := tu.GetItem(1); err == nil {
		v2, ok := v.(*py.Dict)
		if !ok {
			return nil, fmt.Errorf("Expected type *py.Dict for backend.View.RunCommand() arg2, not %s", v.Type())
		}
		if v, err := fromPython(v2); err != nil {
			return nil, err
		} else {
			arg2 = v.(backend.Args)
		}
	}
	backend.GetEditor().CommandHandler().RunTextCommand(o.data, arg1, arg2)
	return toPython(nil)
}
开发者ID:ericcapricorn,项目名称:lime,代码行数:29,代码来源:view_manual.go

示例3: key

// key HandleFunc for the http /key endpoint. This only happens if the client
// doesn't support websockets.
func (t *tbfe) key(w http.ResponseWriter, req *http.Request) {
	log.Debug("key: %s", req)
	kc := req.FormValue("keyCode")
	var kp keys.KeyPress
	v, _ := strconv.ParseInt(kc, 10, 32)

	if req.FormValue("altKey") == "true" {
		kp.Alt = true
	}
	if req.FormValue("ctrlKey") == "true" {
		kp.Ctrl = true
	}
	if req.FormValue("metaKey") == "true" {
		kp.Super = true
	}
	if req.FormValue("shiftKey") == "true" {
		kp.Shift = true
	}

	if !kp.Shift {
		v = int64(unicode.ToLower(rune(v)))
	}
	kp.Key = keys.Key(v)
	kp.Text = string(v)
	backend.GetEditor().HandleInput(kp)
}
开发者ID:hanshenu,项目名称:lime,代码行数:28,代码来源:main.go

示例4: sublime_OkCancelDialog

func sublime_OkCancelDialog(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
		arg2 string
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.DummyFrontend.OkCancelDialog() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	if v, err := tu.GetItem(1); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.DummyFrontend.OkCancelDialog() arg2, not %s", v.Type())
			} else {
				arg2 = v2
			}
		}
	}
	backend.GetEditor().Frontend().OkCancelDialog(arg1, arg2)
	return toPython(nil)
}
开发者ID:jlneder,项目名称:lime,代码行数:34,代码来源:frontend_generated.go

示例5: register

func register(cmds []cmd) {
	e := backend.GetEditor()
	for i := range cmds {
		if err := e.CommandHandler().Register(cmds[i].name, cmds[i].cmd); err != nil {
			log4go.Error("Failed to register command %s: %s", cmds[i].name, err)
		}
	}
}
开发者ID:JREAMLU,项目名称:lime,代码行数:8,代码来源:register.go

示例6: registerByName

func registerByName(cmds []namedCmd) {
	ch := backend.GetEditor().CommandHandler()
	for _, cmd := range cmds {
		if err := ch.Register(cmd.name, cmd.cmd); err != nil {
			log.Error("Failed to register command %s: %s", cmd.name, err)
		}
	}
}
开发者ID:ericcapricorn,项目名称:lime,代码行数:8,代码来源:register.go

示例7: setupEditor

func (t *tbfe) setupEditor() *backend.Editor {
	ed := backend.GetEditor()
	ed.SetFrontend(t)
	ed.LogInput(false)
	ed.LogCommands(false)

	return ed
}
开发者ID:ericcapricorn,项目名称:lime,代码行数:8,代码来源:main.go

示例8: register

func register(cmds []backend.Command) {
	ch := backend.GetEditor().CommandHandler()
	for _, cmd := range cmds {
		if err := ch.RegisterWithDefault(cmd); err != nil {
			log.Error("Failed to register command: %s", err)
		}
	}
}
开发者ID:ericcapricorn,项目名称:lime,代码行数:8,代码来源:register.go

示例9: sublime_PackagesPath

func sublime_PackagesPath() (py.Object, error) {
	ret0 := backend.GetEditor().PackagesPath()
	var err error
	var pyret0 py.Object

	pyret0, err = toPython(ret0)
	if err != nil {
		return nil, err
	}
	return pyret0, err
}
开发者ID:jordonbiondo,项目名称:lime,代码行数:11,代码来源:sublime_api_generated.go

示例10: sublime_NewWindow

func sublime_NewWindow() (py.Object, error) {
	ret0 := backend.GetEditor().NewWindow()
	var err error
	var pyret0 py.Object

	pyret0, err = toPython(ret0)
	if err != nil {
		return nil, err
	}
	return pyret0, err
}
开发者ID:jordonbiondo,项目名称:lime,代码行数:11,代码来源:sublime_api_generated.go

示例11: loadKeyBindings

func (p *plugin) loadKeyBindings() {
	ed := backend.GetEditor()
	tmp := ed.KeyBindings().Parent()

	ed.KeyBindings().SetParent(p)
	p.KeyBindings().Parent().KeyBindings().SetParent(tmp)

	pt := path.Join(p.Name(), "Default.sublime-keymap")
	p.load(packages.NewPacket(pt, p.KeyBindings().Parent().KeyBindings()))

	pt = path.Join(p.Name(), "Default ("+ed.Plat()+").sublime-keymap")
	p.load(packages.NewPacket(pt, p.KeyBindings()))
}
开发者ID:hanshenu,项目名称:lime,代码行数:13,代码来源:sublime_manual.go

示例12: loadSettings

func (p *plugin) loadSettings() {
	ed := backend.GetEditor()
	tmp := ed.Settings().Parent()

	ed.Settings().SetParent(p)
	p.Settings().Parent().Settings().Parent().Settings().SetParent(tmp)

	pt := path.Join(p.Name(), "Preferences.sublime-settings")
	p.load(packages.NewPacket(pt, p.Settings().Parent().Settings().Parent().Settings()))

	pt = path.Join(p.Name(), "Preferences ("+ed.Plat()+").sublime-settings")
	p.load(packages.NewPacket(pt, p.Settings().Parent().Settings()))

	pt = path.Join(backend.LIME_USER_PACKAGES_PATH, "Preferences.sublime-settings")
	p.load(packages.NewPacket(pt, p.Settings()))
}
开发者ID:hanshenu,项目名称:lime,代码行数:16,代码来源:sublime_manual.go

示例13: Py_visible_region

func (o *View) Py_visible_region() (py.Object, error) {
	ret0 := backend.GetEditor().Frontend().VisibleRegion(o.data)
	var err error
	var pyret0 py.Object

	pyret0, err = _regionClass.Alloc(1)
	if err != nil {
		return nil, err
	} else if v2, ok := pyret0.(*Region); !ok {
		return nil, fmt.Errorf("Unable to convert return value to the right type?!: %s", pyret0.Type())
	} else {
		v2.data = ret0
	}
	if err != nil {
		return nil, err
	}
	return pyret0, err
}
开发者ID:ericcapricorn,项目名称:lime,代码行数:18,代码来源:view_manual.go

示例14: sublime_SetClipboard

func sublime_SetClipboard(tu *py.Tuple) (py.Object, error) {
	var (
		arg1 string
	)
	if v, err := tu.GetItem(0); err != nil {
		return nil, err
	} else {
		if v3, err2 := fromPython(v); err2 != nil {
			return nil, err2
		} else {
			if v2, ok := v3.(string); !ok {
				return nil, fmt.Errorf("Expected type string for backend.Editor.SetClipboard() arg1, not %s", v.Type())
			} else {
				arg1 = v2
			}
		}
	}
	backend.GetEditor().SetClipboard(arg1)
	return toPython(nil)
}
开发者ID:jordonbiondo,项目名称:lime,代码行数:20,代码来源:sublime_api_generated.go

示例15: TestUpdateVisibleRegion

func TestUpdateVisibleRegion(t *testing.T) {
	var (
		fe tbfe
		e  = backend.GetEditor()
		w  = e.NewWindow()
		v  = w.NewFile()
	)

	fe.layout = make(map[*backend.View]layout)
	fe.layout[v] = layout{0, 0, 100, 100 - *consoleHeight - 1, Region{}, 0}
	fe.setupCallbacks(v)

	edit := v.BeginEdit()
	v.Insert(edit, 0, "foo")
	v.EndEdit(edit)

	if end := fe.layout[v].visible.End(); end != 3 {
		t.Fatalf("Expected 3, got %d", end)
	}
}
开发者ID:rokite,项目名称:lime,代码行数:20,代码来源:main_test.go


注:本文中的github.com/limetext/lime/backend.GetEditor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。