Skip to content

[merge addon] Add highlightDifferences option and method#1765

Closed
ciaranj wants to merge 1 commit intocodemirror:masterfrom
ciaranj:add_toggle_difference_display
Closed

[merge addon] Add highlightDifferences option and method#1765
ciaranj wants to merge 1 commit intocodemirror:masterfrom
ciaranj:add_toggle_difference_display

Conversation

@ciaranj
Copy link
Copy Markdown
Contributor

@ciaranj ciaranj commented Aug 21, 2013

Note, I'm not expecting this changeset as it currently stands to be the best approach, for example I suspect line 60 is very odd, but it 'works' (I suspect at quite a great performance cost) and I was going to apply the same 'options' based approach used in the core CodeMirror object, but was put off as I'd basically have to copy'n'paste the same code verbatim, the contribution guidelines that I skimmed did not appear to suggest how one should properly do options in this sort of scenario :/ (sorry)

Provides new option (highlightDifferences) and method highlightDifferences(bool)
to the MergeView plugin.

If true (or undefined) the original behaviour is maintained, which is to show
the differences (line highlighting and gutter graphics), if false then
the changes will not be shown.

Calling the method causes the visual change to occur 'immediately'

Signed-off-by: ciaranj ciaranj@gmail.com

Provides new option (highlightDifferences) and method highlightDifferences(bool)
to the MergeView plugin.

If true (or undefined) the original behaviour is maintained, which is to show
the differences (line highlighting and gutter graphics), if false then
the changes will not be shown.

Calling the method causes the visual change to occur 'immediately'

Signed-off-by: ciaranj <ciaranj@gmail.com>
marijnh added a commit that referenced this pull request Aug 22, 2013
@marijnh
Copy link
Copy Markdown
Member

marijnh commented Aug 22, 2013

Merged, followed up by attached patch, which cleans it up a bit and renames the option to showDifferences

@marijnh marijnh closed this Aug 22, 2013
@ciaranj
Copy link
Copy Markdown
Contributor Author

ciaranj commented Aug 22, 2013

Thank you, looks good to me ;)

@ciaranj
Copy link
Copy Markdown
Contributor Author

ciaranj commented Aug 22, 2013

Hmm, the merge appears to be behaving oddly now, what is the correct way to programaticaly set values in the two merge panes? I'm using:

this._mergeViewer.right.orig.setValue( 'foo' );
this._mergeViewer.edit.setValue( 'bar' );

With my previous patch things were working as I expected them to (I believe), now (without ever touching the new showDifferences option, the differences are sometimes out of date, or not shown at all. (If I type in the edit window explicitly the differences are corrected immediately)

@ciaranj
Copy link
Copy Markdown
Contributor Author

ciaranj commented Aug 22, 2013

Yeah, I guess things didn't work correctly (for my perhaps obtuse use-case of wanting to programmatically update what the current edit pane is comparing against). Please see the pull request in #1771 :)

anaran pushed a commit to anaran/CodeMirror that referenced this pull request Feb 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants