Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jumping to first difference (if any) on start-up #2

Open
blais opened this issue Feb 17, 2016 · 4 comments
Open

Jumping to first difference (if any) on start-up #2

blais opened this issue Feb 17, 2016 · 4 comments
Labels
enhancement New feature or request major

Comments

@blais
Copy link
Owner

blais commented Feb 17, 2016

Original report by Anonymous.


I modified xxdiff so that a command-line option will make xxdiff jump to the first difference,
if there is one. I find this very useful. Are you interested in adding such a feature to the official code base?

@blais
Copy link
Owner Author

blais commented Feb 17, 2016

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


Sure, please attach a patch.
I just press "n", but I can see how it would be nice to have it there already.

BTW, I'm not putting much new work into it, the next version will be all console based.

@blais
Copy link
Owner Author

blais commented Feb 20, 2016

Original comment by Jim Diamond (Bitbucket: the_original_zsd, ).


I was using xxdiff under the control of another script and diffing enough files that typing "n"
each time was getting really old.

Since you are interested in the patch:
(1) Disclaimer: I am not a C++ programmer. I probably didn't do things The Right Way.
If you modify this patch to death I won't be the tiniest bit offended.
(2) As you know, the number of free single-char options is low. I picked "k", but I'm not
in love with that choice.
(3) Is there a particular incantation you want me to use to generate the patch?
I haven't submitted anything to bitbucket before, so I'm not aware of best practices here.

Failing knowledge of the right way of doing it, since the changes are small, here is a wrong way of giving you the patches (I just diffed the files I changed). If you would prefer another way, just let me know.

#!c++

diff app.cpp app.cpp.orig
489,492d488
< 
<       if (cmdline._jump_to_first_diff
<           || _resources->getBoolOpt( BOOL_JUMP_TO_FIRST_DIFF ))
<           nextDifference();

diff cmdline.cpp cmdline.cpp.orig
101c101
< // Free simple switch characters: 'q', 'x', 'y'
---
> // Free simple switch characters: 'k', 'p', 'q', 'x', 'y'
157,160d156
<    { "jump_to_first_diff", 'k', false, 'k',
<      "Automatically jump to the first difference in the file, "
<      "if there is one."
<    },
362d357
<    _jump_to_first_diff = false;
496,499d490
<          } break;
< 
<          case 'k': {
<             _jump_to_first_diff = true;

diff cmdline.h cmdline.h.orig
70,71d69
<    bool		 _jump_to_first_diff;
< 

diff resParser.cpp resParser.cpp.orig
222,225d221
<    { "JumpToFirstDiff", JUMP_TO_FIRST_DIFF,
<      "If true, automatically jump to the first difference, "
<      "if one exists." },
< 

diff resParser.y resParser.y.orig
107d106
< %token <num> JUMP_TO_FIRST_DIFF           1017
282d280
< 		| JUMP_TO_FIRST_DIFF

diff resources.cpp resources.cpp.orig
288d287
<    _boolOpts[ BOOL_JUMP_TO_FIRST_DIFF ] = false;

diff resources.h resources.h.orig
97d96
<    BOOL_JUMP_TO_FIRST_DIFF,


@blais
Copy link
Owner Author

blais commented Feb 22, 2016

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


Thank you Jim.
I intended to have a look at this over the weekend, but I haven't been able to.
I'll be traveling for a few weeks for work, I'll try to handle this over the coming month.

@blais
Copy link
Owner Author

blais commented Feb 22, 2016

Original comment by Jim Diamond (Bitbucket: the_original_zsd, ).


On Mon, Feb 22, 2016 at 05:40 (+0000), Martin Blais wrote:

That's a long work trip. I hope it is an enjoyable trip.

Thanks for considering it. I did forget to update the man page. If
you would like me to take a kick at that, let me know.

Cheers.
Jim

@blais blais added major enhancement New feature or request labels May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major
Projects
None yet
Development

No branches or pull requests

1 participant