Merge pull request #32 from bcicen/skip-erase-on-nil-height
skip line erasing on render when window size is not yet available
This commit is contained in:
commit
5212a86596
@ -168,19 +168,21 @@ func (r *Render) renderCompletion(buf *Buffer, completions *CompletionManager) {
|
|||||||
|
|
||||||
// Render renders to the console.
|
// Render renders to the console.
|
||||||
func (r *Render) Render(buffer *Buffer, completion *CompletionManager) {
|
func (r *Render) Render(buffer *Buffer, completion *CompletionManager) {
|
||||||
|
line := buffer.Text()
|
||||||
prefix := r.getCurrentPrefix()
|
prefix := r.getCurrentPrefix()
|
||||||
|
|
||||||
|
if r.col > 0 {
|
||||||
// Erasing
|
// Erasing
|
||||||
r.out.CursorBackward(int(r.col) + len(buffer.Text()) + len(prefix))
|
r.out.CursorBackward(int(r.col) + len(line) + len(prefix))
|
||||||
r.out.EraseDown()
|
r.out.EraseDown()
|
||||||
|
|
||||||
// prepare area
|
// prepare area
|
||||||
line := buffer.Text()
|
|
||||||
h := ((len(prefix) + len(line)) / int(r.col)) + 1 + int(completion.max)
|
h := ((len(prefix) + len(line)) / int(r.col)) + 1 + int(completion.max)
|
||||||
if h > int(r.row) || completionMargin > int(r.col) {
|
if h > int(r.row) || completionMargin > int(r.col) {
|
||||||
r.renderWindowTooSmall()
|
r.renderWindowTooSmall()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
r.renderPrefix()
|
r.renderPrefix()
|
||||||
|
Loading…
Reference in New Issue
Block a user