MCPcopy Create free account
hub / github.com/cogentcore/core / CursorToHistoryNext

Method CursorToHistoryNext

texteditor/nav.go:147–167  ·  view source on GitHub ↗

CursorToHistoryNext moves cursor to previous position on history list -- returns true if moved

()

Source from the content-addressed store, hash-verified

145// CursorToHistoryNext moves cursor to previous position on history list --
146// returns true if moved
147func (ed *Editor) CursorToHistoryNext() bool {
148 if ed.NumLines == 0 || ed.Buffer == nil {
149 ed.CursorPos = lexer.PosZero
150 return false
151 }
152 sz := len(ed.Buffer.posHistory)
153 if sz == 0 {
154 return false
155 }
156 ed.posHistoryIndex++
157 if ed.posHistoryIndex >= sz-1 {
158 ed.posHistoryIndex = sz - 1
159 return false
160 }
161 pos := ed.Buffer.posHistory[ed.posHistoryIndex]
162 ed.CursorPos = ed.Buffer.ValidPos(pos)
163 ed.cursorMovedEvent()
164 ed.scrollCursorToCenterIfHidden()
165 ed.renderCursor(true)
166 return true
167}
168
169// selectRegionUpdate updates current select region based on given cursor position
170// relative to SelectStart position

Callers 1

keyInputMethod · 0.95

Calls 4

cursorMovedEventMethod · 0.95
renderCursorMethod · 0.95
ValidPosMethod · 0.80

Tested by

no test coverage detected