SaveState saves given record of state at given index
(nr *Record, idx int, state []string)
| 181 | |
| 182 | // SaveState saves given record of state at given index |
| 183 | func (us *Stack) SaveState(nr *Record, idx int, state []string) { |
| 184 | if idx%us.RawInterval == 0 { |
| 185 | nr.Raw = state |
| 186 | us.Mu.Unlock() |
| 187 | return |
| 188 | } |
| 189 | prv := us.RecState(idx - 1) |
| 190 | dif := text.DiffLines(prv, state) |
| 191 | nr.Patch = dif.ToPatch(state) |
| 192 | us.Mu.Unlock() |
| 193 | } |
| 194 | |
| 195 | // HasUndoAvail returns true if there is at least one undo record available. |
| 196 | // This does NOT get the lock -- may rarely be inaccurate but is used for |
no test coverage detected