Re: Commit: patch 9.1.0071: Need a diff() Vim script function
On 04-Feb-2024 03:44, Christian Brabandt wrote: On Sa, 03 Feb 2024, John Marriott wrote: Sorry, I'm not sure what the correct fix is. I see Yegappan has already a patch for it in #13964. I'll merge it in a second. Jost wondering, are you usually building without the diff feature? Thanks, Christian Hi Christian, Yeah, I try to keep this build as small as possible. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/28b8a4dc-f557-4647-bb20-1b1231da410a%40internode.on.net.
Re: Commit: patch 9.1.0071: Need a diff() Vim script function
On Sa, 03 Feb 2024, John Marriott wrote: > Sorry, I'm not sure what the correct fix is. I see Yegappan has already a patch for it in #13964. I'll merge it in a second. Jost wondering, are you usually building without the diff feature? Thanks, Christian -- That which is not good for the swarm, neither is it good for the bee. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/Zb5tXCGEUJBBiKKB%40256bit.org.
Re: Commit: patch 9.1.0071: Need a diff() Vim script function
Hi, On Fri, Feb 2, 2024 at 12:56 PM John Marriott wrote: > > > > On 02-Feb-2024 08:30, Christian Brabandt wrote: > > patch 9.1.0071: Need a diff() Vim script function > > Commit: > https://github.com/vim/vim/commit/fa37835b8c0ed0f83952978fca4c332335ca7c46 > Author: Yegappan Lakshmanan > Date: Thu Feb 1 22:05:27 2024 +0100 > > patch 9.1.0071: Need a diff() Vim script function > > Problem: Need a diff() Vim script function > Solution: Add the diff() Vim script function using the > xdiff internal diff library, add support for > "unified" and "indices" mode. > (Yegappan Lakshmanan) > > fixes: #4241 > closes: #12321 > > Signed-off-by: Yegappan Lakshmanan > Signed-off-by: Christian Brabandt > > > After this patch, msys2 (clang x64 17.0.6) gives these errors if FEAT_DIFF is > disabled: > > clang -c -I. -Iproto -DWIN32 -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 > -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO -pipe > -Wall -O3 -fomit-frame-pointer -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD > diff.c -o gobjx86-64/diff.o > diff.c:3499:25: error: use of undeclared identifier > 'DIFF_INTERNAL_OUTPUT_UNIFIED' > 3499 | *diff_output_fmt = DIFF_INTERNAL_OUTPUT_UNIFIED; > |^ > diff.c:3501:25: error: use of undeclared identifier > 'DIFF_INTERNAL_OUTPUT_INDICES' > 3501 | *diff_output_fmt = DIFF_INTERNAL_OUTPUT_INDICES; > |^ > diff.c:3510:15: error: use of undeclared identifier 'DIFF_IBLANK' > 3510 | *diffopts |= DIFF_IBLANK; > | ^ > diff.c:3512:15: error: use of undeclared identifier 'DIFF_ICASE' > 3512 | *diffopts |= DIFF_ICASE; > | ^ > diff.c:3514:15: error: use of undeclared identifier 'DIFF_IWHITE' > 3514 | *diffopts |= DIFF_IWHITE; > | ^ > diff.c:3516:15: error: use of undeclared identifier 'DIFF_IWHITEALL' > 3516 | *diffopts |= DIFF_IWHITEALL; > | ^ > diff.c:3518:15: error: use of undeclared identifier 'DIFF_IWHITEEOL' > 3518 | *diffopts |= DIFF_IWHITEEOL; > | ^ > diff.c:3530:27: error: unknown type name 'diffin_T' > 3530 | list_to_diffin(list_T *l, diffin_T *din, int icase) > | ^ > diff.c:3563:23: error: unknown type name 'diffhunk_T' > 3563 | get_diff_hunk_indices(diffhunk_T *hunk) > | ^ > 9 errors generated. > make: *** [Make_cyg_ming.mak:1214: gobjx86-64/diff.o] Error 1 > > > Sorry, I'm not sure what the correct fix is. > I have created PR #13964 to address this build error. - Yegappan -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7m0%2BtiG%3D49%3DoBfPm%2BxXBx8DNKSGsJxp99BdjYCRKNe2vQ%40mail.gmail.com.
Re: Commit: patch 9.1.0071: Need a diff() Vim script function
On 02-Feb-2024 08:30, Christian Brabandt wrote: patch 9.1.0071: Need a diff() Vim script function Commit:https://github.com/vim/vim/commit/fa37835b8c0ed0f83952978fca4c332335ca7c46 Author: Yegappan Lakshmanan Date: Thu Feb 1 22:05:27 2024 +0100 patch 9.1.0071: Need a diff() Vim script function Problem: Need a diff() Vim script function Solution: Add the diff() Vim script function using the xdiff internal diff library, add support for "unified" and "indices" mode. (Yegappan Lakshmanan) fixes: #4241 closes: #12321 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt After this patch, msys2 (clang x64 17.0.6) gives these errors if FEAT_DIFF is disabled: clang -c -I. -Iproto -DWIN32 -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO -pipe -Wall -O3 -fomit-frame-pointer -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD diff.c -o gobjx86-64/diff.o diff.c:3499:25: error: use of undeclared identifier 'DIFF_INTERNAL_OUTPUT_UNIFIED' 3499 | *diff_output_fmt = DIFF_INTERNAL_OUTPUT_UNIFIED; | ^ diff.c:3501:25: error: use of undeclared identifier 'DIFF_INTERNAL_OUTPUT_INDICES' 3501 | *diff_output_fmt = DIFF_INTERNAL_OUTPUT_INDICES; | ^ diff.c:3510:15: error: use of undeclared identifier 'DIFF_IBLANK' 3510 | *diffopts |= DIFF_IBLANK; | ^ diff.c:3512:15: error: use of undeclared identifier 'DIFF_ICASE' 3512 | *diffopts |= DIFF_ICASE; | ^ diff.c:3514:15: error: use of undeclared identifier 'DIFF_IWHITE' 3514 | *diffopts |= DIFF_IWHITE; | ^ diff.c:3516:15: error: use of undeclared identifier 'DIFF_IWHITEALL' 3516 | *diffopts |= DIFF_IWHITEALL; | ^ diff.c:3518:15: error: use of undeclared identifier 'DIFF_IWHITEEOL' 3518 | *diffopts |= DIFF_IWHITEEOL; | ^ diff.c:3530:27: error: unknown type name 'diffin_T' 3530 | list_to_diffin(list_T *l, diffin_T *din, int icase) | ^ diff.c:3563:23: error: unknown type name 'diffhunk_T' 3563 | get_diff_hunk_indices(diffhunk_T *hunk) | ^ 9 errors generated. make: *** [Make_cyg_ming.mak:1214: gobjx86-64/diff.o] Error 1 Sorry, I'm not sure what the correct fix is. Cheers John -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/579cf8f5-e10f-4607-8ca3-2939cd29b218%40internode.on.net.
Commit: patch 9.1.0071: Need a diff() Vim script function
patch 9.1.0071: Need a diff() Vim script function Commit: https://github.com/vim/vim/commit/fa37835b8c0ed0f83952978fca4c332335ca7c46 Author: Yegappan Lakshmanan Date: Thu Feb 1 22:05:27 2024 +0100 patch 9.1.0071: Need a diff() Vim script function Problem: Need a diff() Vim script function Solution: Add the diff() Vim script function using the xdiff internal diff library, add support for "unified" and "indices" mode. (Yegappan Lakshmanan) fixes: #4241 closes: #12321 Signed-off-by: Yegappan Lakshmanan Signed-off-by: Christian Brabandt diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 5001205ea..19b9bc9f6 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1,4 +1,4 @@ -*builtin.txt* For Vim version 9.1. Last change: 2024 Jan 29 +*builtin.txt* For Vim version 9.1. Last change: 2024 Feb 01 VIM REFERENCE MANUALby Bram Moolenaar @@ -147,6 +147,8 @@ delete({fname} [, {flags}]) Number delete the file or directory {fname} deletebufline({buf}, {first} [, {last}]) Number delete lines from buffer {buf} did_filetype() Number |TRUE| if FileType autocmd event used +diff({fromlist}, {tolist} [, {options}]) + Listdiff two Lists of strings diff_filler({lnum})Number diff filler lines about {lnum} diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col} digraph_get({chars}) String get the |digraph| of {chars} @@ -2046,6 +2048,67 @@ did_filetype() Returns |TRUE| when autocommands are being executed and the editing another buffer to set 'filetype' and load a syntax file. +diff({fromlist}, {tolist} [, {options}]) *diff()* + Returns a String or a List containing the diff between the + strings in {fromlist} and {tolist}. Uses the Vim internal + diff library to compute the diff. + + *E106* + The optional "output" item in {options} specifies the returned + diff format. The following values are supported: + indices Return a List of the starting and ending + indices and a count of the strings in each + diff hunk. + unified Return the unified diff output as a String. + This is the default. + + If the "output" item in {options} is "indices", then a List is + returned. Each List item contains a Dict with the following + items for each diff hunk: + from_idxstart index in {fromlist} for this diff hunk. + from_count number of strings in {fromlist} that are + added/removed/modified in this diff hunk. + to_idx start index in {tolist} for this diff hunk. + to_countnumber of strings in {tolist} that are + added/removed/modified in this diff hunk. + + The {options} Dict argument also specifies diff options + (similar to 'diffopt') and supports the following items: + iblank ignore changes where lines are all + blank. + icase ignore changes in case of text. + iwhite ignore changes in amount of white + space. + iwhiteall ignore all white space changes. + iwhiteeol ignore white space changes at end of + line. + indent-heuristicuse the indent heuristic for the + internal diff library. + algorithm Dict specifying the diff algorithm to + use. Supported boolean items are + "myers", "minimal", "patience" and + "histogram". + For more information about these options, refer to 'diffopt'. + + Returns an empty List or String if {fromlist} and {tolist} are + identical. + + Examples: + :echo diff(['abc'], ['xxx']) +@@ -1 +1 @@ +-abc ++xxx + + :echo diff(['abc'], ['xxx'], {'output': 'indices'}) +[{'from_idx': 0, 'from_count': 1, 'to_idx': 0, 'to_count': 1}] + :echo diff(readfile('oldfile'),