mirror of
https://github.com/makew0rld/amfora.git
synced 2024-12-04 14:46:29 -05:00
🐛 Hardwrap help table cells
This commit is contained in:
parent
d11af6fe20
commit
85e2191a9a
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Changed
|
||||
- Bottom bar now says `URL/Num./Search: ` when space is pressed
|
||||
- Update to [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) v0.6.0
|
||||
- Help layout doesn't have borders anymore
|
||||
|
||||
### Fixed
|
||||
- Actual unicode bullet symbol is used for lists: U+2022
|
||||
@ -25,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Doesn't crash when wrapping certain complex lines (#20)
|
||||
- Input fields are always in focus when they appear (#5)
|
||||
- Reloading the new tab page doesn't cause an error popup
|
||||
- Help table cells are hardwrapped so the text can still be read entirely on an 80-column terminal
|
||||
|
||||
## [1.1.0] - 2020-06-24
|
||||
### Added
|
||||
|
6
NOTES.md
6
NOTES.md
@ -5,7 +5,7 @@
|
||||
- And then just one single map of tab number to `tab`
|
||||
- URL for each tab should not be stored as a string - in the current code there's lots of reparsing the URL
|
||||
|
||||
## Bugs
|
||||
## Upstream Bugs
|
||||
- Wrapping messes up on brackets
|
||||
- Filed [issue 23](https://gitlab.com/tslocum/cview/-/issues/23)
|
||||
- Wrapping panics on strings with brackets and Asian characters
|
||||
@ -17,4 +17,6 @@
|
||||
- Filed [issue 26](https://gitlab.com/tslocum/cview/-/issues/26)
|
||||
- Add some bold back into modal text after this is fixed
|
||||
- Bookmark keys aren't deleted, just set to `""`
|
||||
- Waiting on [this viper PR](https://github.com/spf13/viper/pull/519) to be merged
|
||||
- Waiting on [this viper PR](https://github.com/spf13/viper/pull/519) to be merged
|
||||
- Help table cells aren't dynamically wrapped
|
||||
- Filed [issue 29](https://gitlab.com/tslocum/cview/-/issues/29)
|
@ -18,12 +18,18 @@ b, Alt-Left|Go back in the history
|
||||
f, Alt-Right|Go forward in the history
|
||||
g|Go to top of document
|
||||
G|Go to bottom of document
|
||||
spacebar|Open bar at the bottom - type a URL, link number, or search term. You can also type two dots (..) to go up a directory in the URL, as well as new:N to open link number N in a new tab instead of the current one.
|
||||
Enter|On a page this will start link highlighting. Press Tab and Shift-Tab to pick different links. Press Enter again to go to one, or Esc to stop.
|
||||
spacebar|Open bar at the bottom - type a URL, link number, search term.
|
||||
|You can also type two dots (..) to go up a directory in the URL.
|
||||
|Typing new:N will open link number N in a new tab
|
||||
|instead of the current one.
|
||||
Enter|On a page this will start link highlighting.
|
||||
|Press Tab and Shift-Tab to pick different links.
|
||||
|Press Enter again to go to one, or Esc to stop.
|
||||
Shift-NUMBER|Go to a specific tab.
|
||||
Shift-0, )|Go to the last tab.
|
||||
Ctrl-H|Go home
|
||||
Ctrl-T|New tab, or if a link is selected, this will open the link in a new tab.
|
||||
Ctrl-T|New tab, or if a link is selected,
|
||||
|this will open the link in a new tab.
|
||||
Ctrl-W|Close tab. For now, only the right-most tab can be closed.
|
||||
Ctrl-R, R|Reload a page, discarding the cached version.
|
||||
Ctrl-B|View bookmarks
|
||||
@ -33,7 +39,7 @@ q, Ctrl-Q, Ctrl-C|Quit
|
||||
|
||||
var helpTable = cview.NewTable().
|
||||
SetSelectable(false, false).
|
||||
SetBorders(true).
|
||||
SetBorders(false).
|
||||
SetBordersColor(tcell.ColorGray)
|
||||
|
||||
// Help displays the help and keybindings.
|
||||
@ -55,17 +61,27 @@ func helpInit() {
|
||||
strings.ReplaceAll(helpCells, "\n", "|"),
|
||||
"|")
|
||||
cell := 0
|
||||
extraRows := 0 // Rows continued from the previous, without spacing
|
||||
for r := 0; r < rows; r++ {
|
||||
for c := 0; c < 2; c++ {
|
||||
var tableCell *cview.TableCell
|
||||
if c == 0 {
|
||||
tableCell = cview.NewTableCell(cells[cell]).
|
||||
// First column, the keybinding
|
||||
tableCell = cview.NewTableCell(" " + cells[cell]).
|
||||
SetAttributes(tcell.AttrBold).
|
||||
SetAlign(cview.AlignCenter)
|
||||
SetAlign(cview.AlignLeft)
|
||||
} else {
|
||||
tableCell = cview.NewTableCell(" " + cells[cell])
|
||||
tableCell = cview.NewTableCell(" " + cells[cell])
|
||||
}
|
||||
if c == 0 && cells[cell] == "" || (cell > 0 && cells[cell-1] == "" && c == 1) {
|
||||
// The keybinding column for this row was blank, meaning the explanation
|
||||
// column is continued from the previous row.
|
||||
// The row should be added without any spacing rows
|
||||
helpTable.SetCell(((2*r)-extraRows/2)-1, c, tableCell)
|
||||
extraRows++
|
||||
} else {
|
||||
helpTable.SetCell((2*r)-extraRows/2, c, tableCell) // Every other row, for readability
|
||||
}
|
||||
helpTable.SetCell(r, c, tableCell)
|
||||
cell++
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user