feat: linewrap support

This commit is contained in:
Nao YONASHIRO 2018-02-13 00:48:41 +09:00
parent a34adaee8d
commit 650ffd9fc7

@ -174,8 +174,13 @@ func (r *Render) Render(buffer *Buffer, completion *CompletionManager) {
// In situations where a psuedo tty is allocated (e.g. within a docker container), // In situations where a psuedo tty is allocated (e.g. within a docker container),
// window size via TIOCGWINSZ is not immediately available and will result in 0,0 dimensions. // window size via TIOCGWINSZ is not immediately available and will result in 0,0 dimensions.
if r.col > 0 { if r.col > 0 {
if len(buffer.Document().Text) == 0 {
r.out.CursorBackward(int(r.col))
r.out.SaveCursor()
}
// Erasing // Erasing
r.out.CursorBackward(int(r.col) + len(line) + len(prefix)) r.out.UnSaveCursor()
r.out.SaveCursor()
r.out.EraseDown() r.out.EraseDown()
// prepare area // prepare area
@ -206,8 +211,7 @@ func (r *Render) Render(buffer *Buffer, completion *CompletionManager) {
// BreakLine to break line. // BreakLine to break line.
func (r *Render) BreakLine(buffer *Buffer) { func (r *Render) BreakLine(buffer *Buffer) {
// CR // CR
prefix := r.getCurrentPrefix() r.out.UnSaveCursor()
r.out.CursorBackward(int(r.col) + len(buffer.Text()) + len(prefix))
// Erasing and Render // Erasing and Render
r.out.EraseDown() r.out.EraseDown()
r.renderPrefix() r.renderPrefix()