diff --git a/cmd/micro/highlighter.go b/cmd/micro/highlighter.go index 09935571..f636d87a 100644 --- a/cmd/micro/highlighter.go +++ b/cmd/micro/highlighter.go @@ -472,6 +472,7 @@ func Match(v *View) SyntaxMatches { for _, value := range indicies { start := runePos(value[0], line) end := runePos(value[1], line) + // messenger.Message(start, " ", end) for i := start; i < end; i++ { matches[lineN][i] = rule.style } diff --git a/cmd/micro/messenger.go b/cmd/micro/messenger.go index 01d5f575..2391bca8 100644 --- a/cmd/micro/messenger.go +++ b/cmd/micro/messenger.go @@ -249,7 +249,7 @@ func (m *Messenger) HandleEvent(event tcell.Event, history []string) { } case tcell.KeyBackspace2, tcell.KeyBackspace: if m.cursorx > 0 { - m.response = string([]rune(m.response)[:m.cursorx-1]) + string(m.response[m.cursorx:]) + m.response = string([]rune(m.response)[:m.cursorx-1]) + string([]rune(m.response)[m.cursorx:]) m.cursorx-- } case tcell.KeyRune: diff --git a/cmd/micro/search.go b/cmd/micro/search.go index ddf77aef..dfd194f0 100644 --- a/cmd/micro/search.go +++ b/cmd/micro/search.go @@ -84,10 +84,10 @@ func Search(searchStr string, v *View, down bool) { var charPos int text := v.Buf.String() if down { - str = text[searchStart:] + str = string([]rune(text)[searchStart:]) charPos = searchStart } else { - str = text[:searchStart] + str = string([]rune(text)[:searchStart]) } r, err := regexp.Compile(searchStr) if settings["ignorecase"].(bool) { @@ -127,7 +127,6 @@ func Search(searchStr string, v *View, down bool) { v.Cursor.CurSelection[0] = FromCharPos(charPos+runePos(match[0], str), v.Buf) v.Cursor.CurSelection[1] = FromCharPos(charPos+runePos(match[1], str), v.Buf) - v.Cursor.Loc = FromCharPos(charPos+match[1]-1, v.Buf) if v.Relocate() { v.matches = Match(v) } diff --git a/cmd/micro/view.go b/cmd/micro/view.go index 6ae0d43c..4080fa16 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -624,7 +624,8 @@ func (v *View) DisplayView() { } // Now we actually draw the line - for colN, ch := range line { + colN := 0 + for _, ch := range line { lineStyle := defStyle if settings["syntax"].(bool) { @@ -709,6 +710,7 @@ func (v *View) DisplayView() { } charNum = charNum.Move(1, v.Buf) screenX++ + colN++ } // Here we are at a newline