|
|
|
@ -434,18 +434,19 @@ func (m manager) normalMode(g *gocui.Gui, v *gocui.View) error { |
|
|
|
m.s.highlightedItem = len(m.s.data) - 1 |
|
|
|
m.s.highlightedItem = len(m.s.data) - 1 |
|
|
|
} |
|
|
|
} |
|
|
|
// status line
|
|
|
|
// status line
|
|
|
|
topBoxSize := 3 // size of the query box up top
|
|
|
|
topBoxHeight := 3 // size of the query box up top
|
|
|
|
realLineLength := maxX - 2 |
|
|
|
realLineLength := maxX - 2 |
|
|
|
printedLineLength := maxX - 4 |
|
|
|
printedLineLength := maxX - 4 |
|
|
|
selectedCommand := m.s.data[m.s.highlightedItem].cmdLine |
|
|
|
selectedCommand := m.s.data[m.s.highlightedItem].cmdLine |
|
|
|
var selectedLineCount int = len(selectedCommand)/(printedLineLength) + 1 |
|
|
|
var statusLineHeight int = len(selectedCommand)/(printedLineLength) + 1 |
|
|
|
|
|
|
|
statusLineHeight++ // help line
|
|
|
|
|
|
|
|
|
|
|
|
m.s.displayedItemsCount = maxY - topBoxSize - selectedLineCount |
|
|
|
m.s.displayedItemsCount = maxY - topBoxHeight - statusLineHeight |
|
|
|
|
|
|
|
|
|
|
|
var index int |
|
|
|
var index int |
|
|
|
for index < len(data) { |
|
|
|
for index < len(data) { |
|
|
|
itm := data[index] |
|
|
|
itm := data[index] |
|
|
|
if index == maxY-topBoxSize-selectedLineCount { |
|
|
|
if index == maxY-topBoxHeight-statusLineHeight { |
|
|
|
// page is full
|
|
|
|
// page is full
|
|
|
|
break |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
@ -471,7 +472,7 @@ func (m manager) normalMode(g *gocui.Gui, v *gocui.View) error { |
|
|
|
index++ |
|
|
|
index++ |
|
|
|
} |
|
|
|
} |
|
|
|
// push the status line to the bottom of the page
|
|
|
|
// push the status line to the bottom of the page
|
|
|
|
for index < maxY-topBoxSize-selectedLineCount { |
|
|
|
for index < maxY-topBoxHeight-statusLineHeight { |
|
|
|
v.WriteString("\n") |
|
|
|
v.WriteString("\n") |
|
|
|
index++ |
|
|
|
index++ |
|
|
|
} |
|
|
|
} |
|
|
|
@ -499,6 +500,7 @@ func (m manager) normalMode(g *gocui.Gui, v *gocui.View) error { |
|
|
|
idxSt += printedLineLength |
|
|
|
idxSt += printedLineLength |
|
|
|
nextLine = true |
|
|
|
nextLine = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
v.WriteString("HELP: type to search, UP/DOWN to select, RIGHT to edit, ENTER to execute, CTRL+G to abort, CTRL+C/D to quit") |
|
|
|
if debug { |
|
|
|
if debug { |
|
|
|
log.Println("len(data) =", len(m.s.data)) |
|
|
|
log.Println("len(data) =", len(m.s.data)) |
|
|
|
log.Println("highlightedItem =", m.s.highlightedItem) |
|
|
|
log.Println("highlightedItem =", m.s.highlightedItem) |
|
|
|
|