CursorToHistoryNext moves cursor to previous position on history list -- returns true if moved
()
| 145 | // CursorToHistoryNext moves cursor to previous position on history list -- |
| 146 | // returns true if moved |
| 147 | func (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 |
no test coverage detected