本文整理汇总了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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
}
}
示例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)
}
}
}
示例7: setupEditor
func (t *tbfe) setupEditor() *backend.Editor {
ed := backend.GetEditor()
ed.SetFrontend(t)
ed.LogInput(false)
ed.LogCommands(false)
return ed
}
示例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)
}
}
}
示例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
}
示例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
}
示例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()))
}
示例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()))
}
示例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
}
示例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)
}
示例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)
}
}