From d0fa467a3c901c1948dcd5634130c34880681930 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sun, 11 Sep 2016 16:04:23 -0400 Subject: [PATCH] Revert "Improve performance for very long lines" This reverts commit d5694c0f353d1d4422e128cf54d43d57ab3d89bf. Fixes #351 See #348 --- cmd/micro/cursor.go | 1 - cmd/micro/util.go | 14 -------------- cmd/micro/view.go | 11 ++--------- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/cmd/micro/cursor.go b/cmd/micro/cursor.go index 983c5e20..c6eb92ae 100644 --- a/cmd/micro/cursor.go +++ b/cmd/micro/cursor.go @@ -331,7 +331,6 @@ func (c *Cursor) GetVisualX() int { runes := []rune(c.buf.Line(c.Y)) tabSize := int(c.buf.Settings["tabsize"].(float64)) return StringWidth(string(runes[:c.X]), tabSize) - // return c.Loc.X } // Relocate makes sure that the cursor is inside the bounds of the buffer diff --git a/cmd/micro/util.go b/cmd/micro/util.go index ecd6e7cb..a91295fe 100644 --- a/cmd/micro/util.go +++ b/cmd/micro/util.go @@ -294,17 +294,3 @@ func JoinCommandArgs(args ...string) string { return buf.String() } - -func Sub(str string, start, end int) string { - len := Count(str) - if len > start && len > end { - return str[start:end] - } - if len > start && len < end { - return str[start:] - } - if len < start { - return str - } - return "" -} diff --git a/cmd/micro/view.go b/cmd/micro/view.go index de5ba5c3..889bbf9b 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -690,15 +690,8 @@ func (v *View) DisplayView() { } // Now we actually draw the line - colN := v.leftCol - screenX += v.leftCol - charNum = Loc{v.leftCol, charNum.Y} - for _, ch := range Sub(line, v.leftCol, v.leftCol+v.width) { - if screenX-v.leftCol > v.x+v.width { - charNum = charNum.Move(Count(line[:v.leftCol+v.width]), v.Buf) - break - } - + colN := 0 + for _, ch := range line { lineStyle := defStyle if v.Buf.Settings["syntax"].(bool) {