Ugly fix, but does work. Alleviates issue of resize landing you in deadspace that you should not be able to get to.

This commit is contained in:
sloumdrone 2019-05-28 18:57:50 -07:00
parent 4e27c44061
commit 63df316b96
3 changed files with 20 additions and 11 deletions

View File

@ -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.

View File

@ -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

22
main.go
View File

@ -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()