undo.h (615B)
1 #ifndef UNDO_H_ 2 #define UNDO_H_ 3 4 static int 5 fb_add_to_undo_callback(struct file_buffer* fb, int offset, enum buffer_content_reason reason) 6 { 7 fb_add_to_undo(fb, offset, reason); 8 return 0; 9 } 10 11 static int 12 cursor_undo(struct window_buffer* wb, enum cursor_reason callback_reason) 13 { 14 fb_add_to_undo(get_fb(wb), wb->cursor_offset, FB_CONTENT_CURSOR_MOVE); 15 //writef_to_status_bar("moved to: %d | reason: %d\n", wb->cursor_offset, callback_reason); 16 return 0; 17 } 18 19 static const struct extension undo = { 20 .fb_contents_updated = fb_add_to_undo_callback, 21 .wb_cursor_movement = cursor_undo 22 }; 23 24 #endif // UNDO_H_