~yerinalexey/rex

14f1b655e819e0225da961224dc218a5f63247d8 — Alexey Yerin 4 months ago c6dd421
Keep scroll position when updating matches view

It can get quite annoying when reset scroll position every time the
regular expression is updated, now it won't change the position anymore.
1 files changed, 3 insertions(+), 1 deletions(-)

M main.go
M main.go => main.go +3 -1
@@ 88,6 88,8 @@ func regexWorker(in chan string, tests string, out *tview.TextView) {
				return
			}

			row, column := out.GetScrollOffset()
			
			out.Clear()

			lines := splitLines(tests)


@@ 104,7 106,7 @@ func regexWorker(in chan string, tests string, out *tview.TextView) {
				fmt.Fprintf(out, "[%s]%s[white]\n", color, tview.Escape(line))
			}

			out.ScrollToBeginning()
			out.ScrollTo(row, column)
		})
	}
}