mirror of
https://github.com/Hopiu/micro.git
synced 2026-05-17 03:01:07 +00:00
Revert "Improve performance for very long lines"
This reverts commit d5694c0f35.
Fixes #351
See #348
This commit is contained in:
parent
0bc80adc28
commit
d0fa467a3c
3 changed files with 2 additions and 24 deletions
|
|
@ -331,7 +331,6 @@ func (c *Cursor) GetVisualX() int {
|
||||||
runes := []rune(c.buf.Line(c.Y))
|
runes := []rune(c.buf.Line(c.Y))
|
||||||
tabSize := int(c.buf.Settings["tabsize"].(float64))
|
tabSize := int(c.buf.Settings["tabsize"].(float64))
|
||||||
return StringWidth(string(runes[:c.X]), tabSize)
|
return StringWidth(string(runes[:c.X]), tabSize)
|
||||||
// return c.Loc.X
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Relocate makes sure that the cursor is inside the bounds of the buffer
|
// Relocate makes sure that the cursor is inside the bounds of the buffer
|
||||||
|
|
|
||||||
|
|
@ -294,17 +294,3 @@ func JoinCommandArgs(args ...string) string {
|
||||||
|
|
||||||
return buf.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 ""
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -690,15 +690,8 @@ func (v *View) DisplayView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we actually draw the line
|
// Now we actually draw the line
|
||||||
colN := v.leftCol
|
colN := 0
|
||||||
screenX += v.leftCol
|
for _, ch := range line {
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
lineStyle := defStyle
|
lineStyle := defStyle
|
||||||
|
|
||||||
if v.Buf.Settings["syntax"].(bool) {
|
if v.Buf.Settings["syntax"].(bool) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue