MCPcopy
hub / github.com/micro-editor/micro / WordRight

Method WordRight

internal/buffer/cursor.go:412–440  ·  view source on GitHub ↗

WordRight moves the cursor one word to the right

()

Source from the content-addressed store, hash-verified

410
411// WordRight moves the cursor one word to the right
412func (c *Cursor) WordRight() {
413 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
414 c.Right()
415 return
416 }
417 for util.IsWhitespace(c.RuneUnder(c.X)) {
418 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
419 return
420 }
421 c.Right()
422 }
423 if util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) &&
424 util.IsNonWordChar(c.RuneUnder(c.X+1)) {
425 for util.IsNonWordChar(c.RuneUnder(c.X)) && !util.IsWhitespace(c.RuneUnder(c.X)) {
426 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
427 return
428 }
429 c.Right()
430 }
431 return
432 }
433 c.Right()
434 for util.IsWordChar(c.RuneUnder(c.X)) {
435 if c.X == util.CharacterCount(c.buf.LineBytes(c.Y)) {
436 return
437 }
438 c.Right()
439 }
440}
441
442// WordLeft moves the cursor one word to the left
443func (c *Cursor) WordLeft() {

Callers

nothing calls this directly

Calls 7

RightMethod · 0.95
RuneUnderMethod · 0.95
CharacterCountFunction · 0.92
IsWhitespaceFunction · 0.92
IsNonWordCharFunction · 0.92
IsWordCharFunction · 0.92
LineBytesMethod · 0.65

Tested by

no test coverage detected