Fix bug in utf8 editing & set cursor#103
Closed
aynakeya wants to merge 5 commits intoawesome-gocui:masterfrom
Closed
Fix bug in utf8 editing & set cursor#103aynakeya wants to merge 5 commits intoawesome-gocui:masterfrom
aynakeya wants to merge 5 commits intoawesome-gocui:masterfrom
Conversation
mjarkk
requested changes
Nov 9, 2021
| @@ -1,10 +1,9 @@ | |||
| module github.com/awesome-gocui/gocui | |||
| module github.com/aynakeya/gocui | |||
| if dy == 0 && newY+1 < len(v.lines) { | ||
| newY++ | ||
| // line = v.lines[newY] // Uncomment if adding code that uses line | ||
| //line = v.lines[newY] // Uncomment if adding code that uses line |
Comment on lines
+159
to
+181
| newX, newY := v.cx+dx, v.cy+dy | ||
| // If newY is more than all lines set it to the last line | ||
| if newY >= len(v.lines) { | ||
| newY = len(v.lines) - 1 | ||
| } | ||
| if newY < 0 { | ||
| newY = 0 | ||
| } | ||
| if dx != 0 { | ||
| line := v.lines[newY] | ||
| col := 0 | ||
| for index, _ := range line { | ||
| col += runewidth.RuneWidth(line[index].chr) | ||
| if newX <= col && dx >= 0 { | ||
| dx = runewidth.RuneWidth(line[index].chr) | ||
| break | ||
| } | ||
| if newX < col && dx < 0 { | ||
| dx = -runewidth.RuneWidth(line[index].chr) | ||
| break | ||
| } | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Can you add a comment to what this is doing?
Comment on lines
+286
to
+292
| for i := 1; i < w; i++ { | ||
| v.lines[y][x+i] = cell{ | ||
| fgColor: v.FgColor, | ||
| bgColor: v.BgColor, | ||
| chr: '\x00', | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Can you add a comment to what this is doing?
| require ( | ||
| github.com/gdamore/tcell/v2 v2.0.0 | ||
| github.com/mattn/go-runewidth v0.0.9 | ||
| golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect |
Member
There was a problem hiding this comment.
I don't think we need this change
|
|
||
| import ( | ||
| "errors" | ||
|
|
| } | ||
| } | ||
| v.moveCursor(dx, dy) | ||
| v.gui.userEvents <- userEvent{func(g *Gui) error { return nil }} |
Author
|
sry i forget to create a new branch. gonna create a new pull request again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix problem with delete, insert, cursor move when editing utf8 runes.
Related: jroimartin#74 jesseduffield#10