#include <inttypes.h>
#include <stdbool.h>
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/os/os.h"
#include "nvim/os/shell.h"
#include "nvim/path.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/vim.h"
#include "nvim/window.h"
#include "xdiff/xdiff.h"
Data Structures | |
struct | diffin_T |
struct | diffout_T |
struct | diffhunk_T |
struct | diffio_T |
Macros | |
#define | DIFF_FILLER 0x001 |
#define | DIFF_IBLANK 0x002 |
#define | DIFF_ICASE 0x004 |
#define | DIFF_IWHITE 0x008 |
#define | DIFF_IWHITEALL 0x010 |
#define | DIFF_IWHITEEOL 0x020 |
#define | DIFF_HORIZONTAL 0x040 |
#define | DIFF_VERTICAL 0x080 |
#define | DIFF_HIDDEN_OFF 0x100 |
#define | DIFF_INTERNAL 0x200 |
#define | DIFF_CLOSE_OFF 0x400 |
#define | DIFF_FOLLOWWRAP 0x800 |
#define | ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL) |
#define | LBUFLEN 50 |
Code for diff'ing two, three or four buffers.
There are three ways to diff:
#define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL) |
#define DIFF_CLOSE_OFF 0x400 |
#define DIFF_FILLER 0x001 |
#define DIFF_FOLLOWWRAP 0x800 |
#define DIFF_HIDDEN_OFF 0x100 |
#define DIFF_HORIZONTAL 0x040 |
#define DIFF_IBLANK 0x002 |
#define DIFF_ICASE 0x004 |
#define DIFF_INTERNAL 0x200 |
#define DIFF_IWHITE 0x008 |
#define DIFF_IWHITEALL 0x010 |
#define DIFF_IWHITEEOL 0x020 |
#define DIFF_VERTICAL 0x080 |
#define LBUFLEN 50 |
Add a buffer to make diffs for.
Call this when a new buffer is being edited in the current window where 'diff' is set. Marks the current buffer as being part of the diff and requiring updating. This must be done before any autocmd, because a command may use info about the screen contents.
buf | The buffer to add. |
Check if the current buffer should be added to or removed from the list of diff buffers.
win |
Called when deleting or unloading a buffer: No longer make a diff with it.
buf |
Check diff status for line "lnum" in buffer "buf":
Returns 0 for nothing special Returns -1 for a line that should be highlighted as changed. Returns -2 for a line that should be highlighted as added/deleted. Returns > 0 for inserting that many filler lines above it (never happens when 'diffopt' doesn't contain "filler"). This should only be used for windows where 'diff' is set.
wp | |
lnum |
Find the difference within a changed line.
wp | window whose current buffer to check |
lnum | line number to check within the buffer |
startp | first char of the change |
endp | last char of the change |
Finds the corresponding line in a diff.
buf1 | |
lnum1 |
Check that line "lnum" is not close to a diff block, this line should be in a fold.
wp | window containing the buffer to check |
lnum | line number to check within the buffer |
int diff_internal | ( | void | ) |
Return true if the options are set to use the internal diff library. Note that if the internal diff failed for one of the buffers, the external diff will be used anyway.
Mark the diff info involving buffer "buf" as invalid, it will be updated when info is requested.
buf |
For line "lnum" in the current window find the equivalent lnum in window "wp", compensating for inserted/deleted lines.
Called by mark_adjust(): update line numbers in "curbuf".
line1 | |
line2 | |
amount | |
amount_after |
Checks that the buffer is in diff-mode.
buf | buffer to check. |
int diff_move_to | ( | int | dir, |
long | count | ||
) |
Move "count" times in direction "dir" to the next diff block.
dir | |
count |
Mark all diff buffers in the current tab page for redraw.
dofold | Also recompute the folds |
Set the topline of "towin" to match the position in "fromwin", so that they show the same diff'ed lines.
fromwin | |
towin |
Set options in window "wp" for diff mode.
addbuf | Add buffer to diff. |
int diffopt_changed | ( | void | ) |
This is called when 'diffopt' is changed.
Set options not to show diffs. For the current window or all windows. Only in the current tab page.
eap |
Create a new version of a file from the current buffer and a diff file.
The buffer is written to a file, also for unmodified buffers (the file could have been produced by autocommands, e.g. the netrw plugin).
eap |
Split the window and edit another file, setting options to show the diffs.
eap |
Completely update the diffs for the buffers involved.
When using the external "diff" command the buffers are written to a file, also for unmodified buffers (the file could have been produced by autocommands, e.g. the netrw plugin).
eap | can be NULL |