Preserve the cursor position when changing the diff context
[tig.git] / include / tig / diff.h
blob158875766504a51f4df4f551f8a30e31e0531a9b
1 /* Copyright (c) 2006-2014 Jonas Fonseca <jonas.fonseca@gmail.com>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef TIG_DIFF_H
15 #define TIG_DIFF_H
17 #include "tig/view.h"
19 struct diff_state {
20 bool after_commit_title;
21 bool after_diff;
22 bool reading_diff_stat;
23 bool combined_diff;
24 const char *file;
25 unsigned int lineno;
26 struct position pos;
29 enum request diff_common_edit(struct view *view, enum request request, struct line *line);
30 bool diff_common_read(struct view *view, const char *data, struct diff_state *state);
31 enum request diff_common_enter(struct view *view, enum request request, struct line *line);
32 struct line *diff_common_add_diff_stat(struct view *view, const char *text, size_t offset);
33 void diff_save_line(struct view *view, struct diff_state *state, enum open_flags flags);
34 void diff_restore_line(struct view *view, struct diff_state *state);
36 unsigned int diff_get_lineno(struct view *view, struct line *line);
37 const char *diff_get_pathname(struct view *view, struct line *line);
39 extern struct view diff_view;
41 static inline void
42 open_diff_view(struct view *prev, enum open_flags flags)
44 open_view(prev, &diff_view, flags);
47 #endif
48 /* vim: set ts=8 sw=8 noexpandtab: */