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:
parent
4e27c44061
commit
63df316b96
|
@ -39,7 +39,7 @@ If you would prefer to download a binary for your system, rather than build from
|
||||||
|
|
||||||
### Documentation
|
### 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.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,13 @@ func (w *Window) DrawContent() {
|
||||||
content := wrapLines(w.Content, width)
|
content := wrapLines(w.Content, width)
|
||||||
w.tempContentLen = len(content)
|
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 {
|
if len(content) < w.Scrollposition+height {
|
||||||
maxlines = len(content)
|
maxlines = len(content)
|
||||||
short_content = true
|
short_content = true
|
||||||
|
|
22
main.go
22
main.go
|
@ -459,15 +459,15 @@ func handleResize() {
|
||||||
oldh, oldw := screen.Height, screen.Width
|
oldh, oldw := screen.Height, screen.Width
|
||||||
screen.GetSize()
|
screen.GetSize()
|
||||||
if screen.Height != oldh || screen.Width != oldw {
|
if screen.Height != oldh || screen.Width != oldw {
|
||||||
screen.Windows[0].Box.Row2 = screen.Height - 2
|
screen.Windows[0].Box.Row2 = screen.Height - 2
|
||||||
screen.Windows[0].Box.Col2 = screen.Width
|
screen.Windows[0].Box.Col2 = screen.Width
|
||||||
bookmarksWidth := 40
|
bookmarksWidth := 40
|
||||||
if screen.Width < 40 {
|
if screen.Width < 40 {
|
||||||
bookmarksWidth = screen.Width
|
bookmarksWidth = screen.Width
|
||||||
}
|
}
|
||||||
screen.Windows[1].Box.Row2 = screen.Height - 2
|
screen.Windows[1].Box.Row2 = screen.Height - 2
|
||||||
screen.Windows[1].Box.Col1 = screen.Width - bookmarksWidth
|
screen.Windows[1].Box.Col1 = screen.Width - bookmarksWidth
|
||||||
screen.Windows[1].Box.Col2 = screen.Width
|
screen.Windows[1].Box.Col2 = screen.Width
|
||||||
|
|
||||||
screen.DrawAllWindows()
|
screen.DrawAllWindows()
|
||||||
screen.DrawMsgBars()
|
screen.DrawMsgBars()
|
||||||
|
@ -500,7 +500,9 @@ func main() {
|
||||||
|
|
||||||
for {
|
for {
|
||||||
c := cui.Getch()
|
c := cui.Getch()
|
||||||
handleResize()
|
|
||||||
|
handleResize()
|
||||||
|
|
||||||
switch c {
|
switch c {
|
||||||
case 'j', 'J':
|
case 'j', 'J':
|
||||||
screen.Windows[screen.Activewindow].ScrollDown()
|
screen.Windows[screen.Activewindow].ScrollDown()
|
||||||
|
|
Loading…
Reference in New Issue