Fix SEGV when trying to render preview but the window is closed

Close #677
pull/695/head
Junegunn Choi 8 years ago
parent 3b5ae0f8a2
commit 957c12e7d7
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

@ -1,6 +1,11 @@
CHANGELOG CHANGELOG
========= =========
0.15.3
------
- Added support for more ANSI attributes: dim, underline, blink, and reverse
- Fixed race condition in `toggle-preview`
0.15.2 0.15.2
------ ------
- Preview window is now scrollable - Preview window is now scrollable

@ -796,6 +796,9 @@ func numLinesMax(str string, max int) int {
} }
func (t *Terminal) printPreview() { func (t *Terminal) printPreview() {
if !t.isPreviewEnabled() {
return
}
t.pwindow.Erase() t.pwindow.Erase()
skip := t.previewer.offset skip := t.previewer.offset
extractColor(t.previewer.text, nil, func(str string, ansi *ansiState) bool { extractColor(t.previewer.text, nil, func(str string, ansi *ansiState) bool {
@ -839,9 +842,7 @@ func (t *Terminal) printAll() {
t.printPrompt() t.printPrompt()
t.printInfo() t.printInfo()
t.printHeader() t.printHeader()
if t.isPreviewEnabled() { t.printPreview()
t.printPreview()
}
} }
func (t *Terminal) refresh() { func (t *Terminal) refresh() {

Loading…
Cancel
Save