diff --git a/README.md b/README.md index 7f9c130..71c9495 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ If you would prefer to download a binary for your system, rather than build from ### Documentation -Bombadillo has documentation available in two places currently. The first if the [Bombadillo homepage](https://rawtext.club/~sloum/bombadillo.html#docs), which has lots of information about the program, links to places around Gopher, and documentation of the commands and configuration options. +Bombadillo has documentation available in two places currently. The first is the [Bombadillo homepage](https://rawtext.club/~sloum/bombadillo.html#docs), which has lots of information about the program, links to places around Gopher, and documentation of the commands and configuration options. Secondly, and possibly more importantly, documentation is available via Gopher from within Bombadillo. When a user launches Bombadillo for the first time, their `homeurl` is set to the help file. As such they will have access to all of the key bindings, commands, and configuration from the first run. A user can also type `:?` or `:help` at any time to return to the documentation. Remember that Bombadillo uses vim-like key bindings, so scroll with `j` and `k` to view the docs file. diff --git a/cui/window.go b/cui/window.go index fe82cd5..f2f459f 100644 --- a/cui/window.go +++ b/cui/window.go @@ -68,6 +68,13 @@ func (w *Window) DrawContent() { content := wrapLines(w.Content, width) w.tempContentLen = len(content) + if w.Scrollposition > w.tempContentLen-height { + w.Scrollposition = w.tempContentLen-height + if w.Scrollposition < 0 { + w.Scrollposition = 0 + } + } + if len(content) < w.Scrollposition+height { maxlines = len(content) short_content = true diff --git a/main.go b/main.go index 3cc2e26..0568e69 100644 --- a/main.go +++ b/main.go @@ -459,15 +459,15 @@ func handleResize() { oldh, oldw := screen.Height, screen.Width screen.GetSize() if screen.Height != oldh || screen.Width != oldw { - screen.Windows[0].Box.Row2 = screen.Height - 2 - screen.Windows[0].Box.Col2 = screen.Width - bookmarksWidth := 40 - if screen.Width < 40 { - bookmarksWidth = screen.Width - } - screen.Windows[1].Box.Row2 = screen.Height - 2 - screen.Windows[1].Box.Col1 = screen.Width - bookmarksWidth - screen.Windows[1].Box.Col2 = screen.Width + screen.Windows[0].Box.Row2 = screen.Height - 2 + screen.Windows[0].Box.Col2 = screen.Width + bookmarksWidth := 40 + if screen.Width < 40 { + bookmarksWidth = screen.Width + } + screen.Windows[1].Box.Row2 = screen.Height - 2 + screen.Windows[1].Box.Col1 = screen.Width - bookmarksWidth + screen.Windows[1].Box.Col2 = screen.Width screen.DrawAllWindows() screen.DrawMsgBars() @@ -500,7 +500,9 @@ func main() { for { c := cui.Getch() - handleResize() + + handleResize() + switch c { case 'j', 'J': screen.Windows[screen.Activewindow].ScrollDown()