mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 07:37:23 +00:00
Bug #24: Cursor now moves to end of message
This commit is contained in:
@ -49,6 +49,7 @@ func cmdEdit(cmd []string) {
|
|||||||
popupView("Edit")
|
popupView("Edit")
|
||||||
printToView("Edit", fmt.Sprintf("/e %d %s", messageID, editString))
|
printToView("Edit", fmt.Sprintf("/e %d %s", messageID, editString))
|
||||||
setViewTitle("Edit", fmt.Sprintf(" Editing message %d ", messageID))
|
setViewTitle("Edit", fmt.Sprintf(" Editing message %d ", messageID))
|
||||||
|
moveCursorToEnd("Edit")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(cmd) < 3 {
|
if len(cmd) < 3 {
|
||||||
|
|||||||
16
main.go
16
main.go
@ -202,6 +202,22 @@ func popupView(viewName string) {
|
|||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
func moveCursorToEnd(viewName string) {
|
||||||
|
g.Update(func(g *gocui.Gui) error {
|
||||||
|
inputView, err := g.View(viewName)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
inputString, _ := getInputString(viewName)
|
||||||
|
stringLen := len(inputString)
|
||||||
|
maxX, _ := inputView.Size()
|
||||||
|
x := stringLen % maxX
|
||||||
|
y := stringLen / maxX
|
||||||
|
inputView.MoveCursor(x, y, true)
|
||||||
|
return nil
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
func clearView(viewName string) {
|
func clearView(viewName string) {
|
||||||
g.Update(func(g *gocui.Gui) error {
|
g.Update(func(g *gocui.Gui) error {
|
||||||
inputView, err := g.View(viewName)
|
inputView, err := g.View(viewName)
|
||||||
|
|||||||
Reference in New Issue
Block a user