!101 添加修改detail视图的热键,及其响应函数

Merge pull request !101 from a-alpha/alpha-dev
This commit is contained in:
a-alpha 2022-11-16 18:53:55 +00:00 committed by Gitee
commit 1a32c31f89
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 52 additions and 20 deletions

View File

@ -148,25 +148,57 @@ func (fr *FrameReport)FrameReportKBind(g *gocui.Gui) error {
gocui.KeyCtrlP, gocui.ModNone, fr.PreSummary))
// detail
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyTab, gocui.ModNone, fr.NextView))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlQ, gocui.ModNone, fr.PreView))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlH, gocui.ModNone, fr.NextView))
// rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlL, gocui.ModNone, fr.NextView))
// rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyArrowUp, gocui.ModAlt, fr.PreView))
// rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyArrowLeft, gocui.ModAlt, fr.NextView))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyArrowDown, gocui.ModNone, fr.CursorDown))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyArrowUp, gocui.ModNone, fr.CursorUp))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlJ, gocui.ModNone, fr.CursorDown))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlK, gocui.ModNone, fr.CursorUp))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlD, gocui.ModNone, fr.CursorPageDown))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlU, gocui.ModNone, fr.CursorPageUp))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeySpace, gocui.ModNone, fr.CursorPageDown))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyBackspace, gocui.ModNone, fr.CursorPageUp))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyBackspace2, gocui.ModNone, fr.CursorPageUp))
// rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlM, gocui.ModNone, fr.CursorMoveMiddle))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlN, gocui.ModNone, fr.NextSummary))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyCtrlP, gocui.ModNone, fr.PreSummary))
rcs = append(rcs, g.SetKeybinding("detail", gocui.KeyEnter, gocui.ModNone, fr.NextView))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyTab, gocui.ModNone, fr.NextView))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlQ, gocui.ModNone, fr.PreView))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlH, gocui.ModNone, fr.NextView))
// rcs = append(rcs, g.SetKeybinding(FRAMEREPORTVIEW_VIEWNAME_DETAIL, gocui.KeyCtrlL, gocui.ModNone, fr.NextView))
// rcs = append(rcs, g.SetKeybinding(FRAMEREPORTVIEW_VIEWNAME_DETAIL, gocui.KeyArrowUp, gocui.ModAlt, fr.PreView))
// rcs = append(rcs, g.SetKeybinding(FRAMEREPORTVIEW_VIEWNAME_DETAIL, gocui.KeyArrowLeft, gocui.ModAlt, fr.NextView))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyArrowDown, gocui.ModNone, fr.CursorDown))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyArrowUp, gocui.ModNone, fr.CursorUp))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlJ, gocui.ModNone, fr.CursorDown))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlK, gocui.ModNone, fr.CursorUp))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlD, gocui.ModNone, fr.CursorPageDown))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlU, gocui.ModNone, fr.CursorPageUp))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeySpace, gocui.ModNone, fr.CursorPageDown))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyBackspace, gocui.ModNone, fr.CursorPageUp))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyBackspace2, gocui.ModNone, fr.CursorPageUp))
// rcs = append(rcs, g.SetKeybinding(
// FRAMEREPORTVIEW_VIEWNAME_DETAIL,
// gocui.KeyCtrlM, gocui.ModNone, fr.CursorMoveMiddle))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlN, gocui.ModNone, fr.NextSummary))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyCtrlP, gocui.ModNone, fr.PreSummary))
rcs = append(rcs, g.SetKeybinding(
FRAMEREPORTVIEW_VIEWNAME_DETAIL,
gocui.KeyEnter, gocui.ModNone, fr.NextView))
for _, rc := range rcs {
if rc != nil {

View File

@ -93,7 +93,7 @@ func (fr *FrameReport)SetSummaryLayout(g *gocui.Gui) error {
func (fr *FrameReport)SetDetailLayout(g *gocui.Gui) error {
maxX, maxY := g.Size()
view, rc := g.SetView("detail", 40, int(float64(maxY)*0.3), maxX, maxY)
view, rc := g.SetView(FRAMEREPORTVIEW_VIEWNAME_DETAIL, 40, int(float64(maxY)*0.3), maxX, maxY)
/* */
if (nil != rc) {
if (gocui.ErrUnknownView != rc) {