fix: updated via using feedback from Qodo
This commit is contained in:
parent
b23072b43f
commit
1166a67c64
@ -534,7 +534,19 @@ func prevWordEnd(buf *core.Buffer, x, y int) (int, int) {
|
||||
}
|
||||
}
|
||||
|
||||
// We're now at the end of the previous word - that's the answer!
|
||||
// Now x,y is at the start of the target word. Move forward to its end.
|
||||
if x >= 0 {
|
||||
if isWordChar(line[x]) {
|
||||
for x+1 < len(line) && isWordChar(line[x+1]) {
|
||||
x++
|
||||
}
|
||||
} else if isWordPunctuation(line[x]) {
|
||||
for x+1 < len(line) && isWordPunctuation(line[x+1]) {
|
||||
x++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return x, y
|
||||
}
|
||||
|
||||
@ -594,7 +606,13 @@ func prevWORDEnd(buf *core.Buffer, x, y int) (int, int) {
|
||||
}
|
||||
}
|
||||
|
||||
// We're now at the end of the previous WORD - that's the answer!
|
||||
// Now x,y is at the start of the target WORD. Move forward to its end.
|
||||
if x >= 0 {
|
||||
for x+1 < len(line) && line[x+1] != ' ' && line[x+1] != '\t' {
|
||||
x++
|
||||
}
|
||||
}
|
||||
|
||||
return x, y
|
||||
}
|
||||
|
||||
|
||||
@ -87,6 +87,10 @@ func yankNormalMode(m action.Model, start, end core.Position, mtype core.MotionT
|
||||
cnt := line[startX:endX]
|
||||
m.UpdateDefaultRegister(core.CharwiseRegister, []string{cnt})
|
||||
|
||||
win := m.ActiveWindow()
|
||||
win.SetCursorCol(startX)
|
||||
win.SetCursorLine(start.Line)
|
||||
|
||||
case mtype == core.Linewise:
|
||||
// These don't need to be validated, they are validated before being passed into the function
|
||||
startY := min(start.Line, end.Line)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user