本文整理汇总了Golang中github.com/jroimartin/gocui.View.Origin方法的典型用法代码示例。如果您正苦于以下问题:Golang View.Origin方法的具体用法?Golang View.Origin怎么用?Golang View.Origin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jroimartin/gocui.View
的用法示例。
在下文中一共展示了View.Origin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: cursorPageDown
func cursorPageDown(g *gocui.Gui, v *gocui.View) error {
jump := pageUpDownJumpCount(v)
if v != nil {
cx, cy := v.Cursor()
ox, oy := v.Origin()
ok, yLimit := movable(v, oy+cy+jump)
_, maxY := v.Size()
if !ok {
if yLimit < maxY {
v.SetCursor(cx, yLimit)
} else {
v.SetCursor(cx, maxY-1)
v.SetOrigin(ox, yLimit-maxY+1)
}
} else if yLimit < oy+jump+maxY {
if yLimit < maxY {
v.SetCursor(cx, yLimit)
} else {
v.SetOrigin(ox, yLimit-maxY+1)
v.SetCursor(cx, maxY-1)
}
} else {
v.SetCursor(cx, cy)
v.SetOrigin(ox, oy+jump)
}
onMovingCursorRedrawView(g, v)
}
return nil
}
示例2: codeComplete
func codeComplete(g *gocui.Gui, v *gocui.View) error {
if v != nil {
ox, oy := v.Origin()
cx, cy := v.Cursor()
x, y := ox+cx, oy+cy
f := proj.GetFile("test.go")
off := f.GetOffset(x, y)
cands := codecomplete.Complete(proj, f, off)
maxX, maxY := g.Size()
maxY = maxY/2 - (len(cands) / 2)
if v, err := g.SetView("msg", maxX/2-30, maxY, maxX/2+30, maxY+len(cands)+2); err != nil {
if err != gocui.ErrorUnkView {
return err
}
fmt.Fprintln(v, x, y, off)
for _, c := range cands {
fmt.Fprintln(v, c.Name, c.Perc)
}
if err := g.SetCurrentView("msg"); err != nil {
return err
}
}
}
return nil
}
示例3: confirmListDetail
func (runner *appRunner) confirmListDetail(gui *gocui.Gui, view *gocui.View) error {
_, originY := view.Origin()
_, cursorY := view.Cursor()
runner.activeListDetailController.Confirm(originY + cursorY)
runner.restoreMainView()
runner.gui.DeleteView(view.Name())
return nil
}
示例4: textUp
func textUp(g *gocui.Gui, v *gocui.View) error {
if v, err := g.View(vText); err == nil {
ox, oy := v.Origin()
oy = oy - 10
v.SetOrigin(ox, oy)
}
return nil
}
示例5: cursorHome
func cursorHome(g *gocui.Gui, v *gocui.View) error {
ox, _ := v.Origin()
cx, _ := v.Cursor()
v.SetCursor(cx, 0)
v.SetOrigin(ox, 0)
updateTracksView(g, v)
return nil
}
示例6: transcriptsMenuDown
func transcriptsMenuDown(g *gocui.Gui, v *gocui.View) error {
length := 5
_, cy := v.Cursor()
_, oy := v.Origin()
if cy+oy < length-1 {
return menuDown(g, v)
}
return nil
}
示例7: platformsMenuDown
func platformsMenuDown(g *gocui.Gui, v *gocui.View) error {
length := 3
_, cy := v.Cursor()
_, oy := v.Origin()
if cy+oy < length-1 {
return menuDown(g, v)
}
return nil
}
示例8: destinationsMenuDown
func destinationsMenuDown(g *gocui.Gui, v *gocui.View) error {
length := 9
_, cy := v.Cursor()
_, oy := v.Origin()
if cy+oy < length-1 {
return menuDown(g, v)
}
return nil
}
示例9: scrollView
func scrollView(v *gocui.View, dy int) error {
if v != nil {
v.Autoscroll = false
ox, oy := v.Origin()
if err := v.SetOrigin(ox, oy+dy); err != nil {
return err
}
}
return nil
}
示例10: moveRight
func moveRight(g *gocui.Gui, v *gocui.View) error {
if v != nil {
cx, cy := v.Cursor()
if err := v.SetCursor(cx+1, cy); err != nil {
ox, oy := v.Origin()
if err := v.SetOrigin(ox+1, oy); err != nil {
return err
}
}
}
return nil
}
示例11: cursorLeft
func cursorLeft(g *gocui.Gui, v *gocui.View) error {
if v != nil {
ox, oy := v.Origin()
cx, cy := v.Cursor()
if err := v.SetCursor(cx-1, cy); err != nil && ox > 0 {
if err := v.SetOrigin(ox-1, oy); err != nil {
return err
}
}
}
return nil
}
示例12: cursorUp
func cursorUp(g *gocui.Gui, v *gocui.View) error {
if v != nil {
ox, oy := v.Origin()
cx, cy := v.Cursor()
if err := v.SetCursor(cx, cy-1); err != nil && oy > 0 {
if err := v.SetOrigin(ox, oy-1); err != nil {
return err
}
}
}
return nil
}
示例13: cursorDown
func cursorDown(g *gocui.Gui, v *gocui.View) error {
if v != nil {
cx, cy := v.Cursor()
if err := v.SetCursor(cx, cy+1); err != nil {
ox, oy := v.Origin()
if err := v.SetOrigin(ox, oy+1); err != nil {
return err
}
}
}
return nil
}
示例14: cursorUp
func cursorUp(g *gocui.Gui, v *gocui.View) error {
if v != nil {
ox, oy := v.Origin()
cx, cy := v.Cursor()
if err := v.SetCursor(cx, cy-1); err != nil && 0 < oy {
if err := v.SetOrigin(ox, oy-1); err != nil {
return err
}
}
}
onMovingCursorRedrawView(g, v)
return nil
}
示例15: cursorUp
func (runner *appRunner) cursorUp(g *gocui.Gui, v *gocui.View) error {
if v != nil {
ox, oy := v.Origin()
cx, cy := v.Cursor()
if err := v.SetCursor(cx, cy-1); err != nil && oy > 0 {
if err := v.SetOrigin(ox, oy-1); err != nil {
return err
}
}
runner.layout(g)
}
return nil
}