本文整理匯總了Golang中github.com/limetext/text.Region.A方法的典型用法代碼示例。如果您正苦於以下問題:Golang Region.A方法的具體用法?Golang Region.A怎麽用?Golang Region.A使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/limetext/text.Region
的用法示例。
在下文中一共展示了Region.A方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Py_substr
func (o *View) Py_substr(tu *py.Tuple) (py.Object, error) {
var (
arg1 text.Region
)
v, err := tu.GetItem(0)
if err != nil {
return nil, err
}
if v2, ok := v.(*Region); !ok {
if v2, ok := v.(*py.Long); !ok {
return nil, fmt.Errorf("Expected type *Region or *Int for primitives.Buffer.Substr() arg1, not %s", v.Type())
} else {
arg1.A = int(v2.Int64())
arg1.B = arg1.A + 1
}
} else {
arg1 = v2.data
}
ret0 := o.data.Buffer().Substr(arg1)
var pyret0 py.Object
pyret0, err = py.NewUnicode(ret0)
if err != nil {
// TODO: do the py objs need to be freed?
return nil, err
}
return pyret0, err
}
示例2: Py_expand_by_class
func (o *View) Py_expand_by_class(tu *py.Tuple, kw *py.Dict) (py.Object, error) {
var (
arg1 text.Region
arg2 int
)
if v, err := tu.GetItem(0); err != nil {
return nil, err
} else {
if v2, ok := v.(*Region); !ok {
if v2, ok := v.(*py.Long); !ok {
return nil, fmt.Errorf("Expected type *Region or *Int for backend.View.ExpandByClass() arg1, not %s", v.Type())
} else {
arg1.A = int(v2.Int64())
arg1.B = arg1.A + 1
}
} else {
arg1 = v2.data
}
}
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.(int); !ok {
return nil, fmt.Errorf("Expected type int for backend.View.ExpandByClass() arg2, not %s", v.Type())
} else {
arg2 = v2
}
}
}
ret := o.data.ExpandByClass(arg1, arg2)
var err error
var pyret py.Object
pyret, err = toPython(ret)
if err != nil {
return nil, err
}
return pyret, err
}
示例3: Py_show
func (view *View) Py_show(tu *py.Tuple, kw *py.Dict) (py.Object, error) {
var (
arg1 text.Region
)
v, err := tu.GetItem(0)
if err != nil {
return nil, err
}
if v2, ok := v.(*Region); !ok {
if v2, ok := v.(*py.Long); !ok {
return nil, fmt.Errorf("Expected type *Region or *Int for primitives.Buffer.Substr() arg1, not %s", v.Type())
} else {
arg1.A = int(v2.Int64())
arg1.B = arg1.A + 1
}
} else {
arg1 = v2.data
}
backend.GetEditor().Frontend().Show(view.data, arg1)
return toPython(nil)
}