Skip to content

Replace nvda_dmp with an integrated implementation#18480

Merged
seanbudd merged 4 commits into
nvaccess:masterfrom
codeofdusk:native-dmp
Jul 21, 2025
Merged

Replace nvda_dmp with an integrated implementation#18480
seanbudd merged 4 commits into
nvaccess:masterfrom
codeofdusk:native-dmp

Conversation

@codeofdusk

@codeofdusk codeofdusk commented Jul 16, 2025

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #16633

Summary of the issue:

Right now, NVDA uses nvda_dmp as a proxy to interact with the fast-diff-match-patch library. This approach is inefficient, inflexible, and sometimes unreliable.

Description of how this pull request fixes the issue:

Remove nvda_dmp completely, replacing it with a refactored diffHandler.DiffMatchPatch class that calls DMP directly.

Testing strategy:

Tested over a few days of heavy terminal usage across both wt and formatted UIA conhost, including the alt buffer. Alpha testing.

Known issues with pull request:

None known

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@seanbudd

Copy link
Copy Markdown
Member

I think we should remove the old DMP option entirely if we are switching, and trial making the new option default

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Agreed with @seanbudd

@codeofdusk

Copy link
Copy Markdown
Contributor Author

Agree in principle, but I'd like to have this more thoroughly tested in a non backwards compat breaking release if possible

@LeonarddeR

Copy link
Copy Markdown
Collaborator

What makes you think that testing this in a non api breaking release is necessary?

@codeofdusk

Copy link
Copy Markdown
Contributor Author

What makes you think that testing this in a non api breaking release is necessary?

Sorry, I mean removing the old implementation.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Ah that makes sense. I don't think there's anything API breaking when you move to the native implementation, everything is in private methods. Unless someone uses the process directly in an add-on, but that's just weird.

@codeofdusk codeofdusk force-pushed the native-dmp branch 2 times, most recently from cd9b6b5 to c8dfd90 Compare July 20, 2025 22:37
@codeofdusk codeofdusk marked this pull request as ready for review July 20, 2025 22:38
Copilot AI review requested due to automatic review settings July 20, 2025 22:38
@codeofdusk codeofdusk requested review from a team as code owners July 20, 2025 22:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a native implementation of the diff-match-patch algorithm to improve terminal text processing performance and reliability by eliminating the need for an external process.

  • Adds DiffMatchPatchNative class that calls the fast-diff-match-patch library directly within NVDA
  • Updates configuration options to include the new "Diff Match Patch (native)" algorithm choice
  • Modifies the automatic algorithm preference to favor the native implementation

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
user_docs/en/userGuide.md Documents the new native diff algorithm option in advanced settings
user_docs/en/changes.md Adds changelog entry describing the performance improvement and deprecation notice
source/gui/settingsDialogs.py Updates UI to include new "Diff Match Patch (native)" option in combo box
source/diffHandler.py Implements the core DiffMatchPatchNative class and updates algorithm selection logic
source/config/configSpec.py Adds "dmp-native" as a valid configuration option

Comment thread source/diffHandler.py
Comment thread source/diffHandler.py
@codeofdusk

Copy link
Copy Markdown
Contributor Author

The CI failures seem unrelated to this PR?

@seanbudd

Copy link
Copy Markdown
Member

@codeofdusk - could you please answer @LeonarddeR's latest question? What do you think would be API breaking here?
I still believe we should remove the old DMP option entirely if we are switching

@codeofdusk

Copy link
Copy Markdown
Contributor Author

What do you think would be API breaking here?

The removal of the nvda_dmp utility.

I still believe we should remove the old DMP option entirely if we are switching

In the past, we've typically put terminal changes behind advanced config settings (#9614, #14047, etc.) to allow for long periods of testing time with an easy revert path. This is also standard practice for non-terminal features (#10885, #11214, etc.). Is there a strong need to remove nvda_dmp before 2026.1?

@seanbudd

Copy link
Copy Markdown
Member

Using that utility directly is not part of the NVDA API. Similarly, we wouldn't consider changes to l10nUtil to be API breaking.
I think keeping it adds unnecessary complexity for users. We also have no plans to keep the separate utility long term. It's quite unusual for us to even have code in the first place included like it as a separate binary. even if there are issues with the new system, we don't think it's worthwhile supporting 2 different systems with issues. we just should make a hard switch. if there are severe issues we can always revert this PR temporarily, but the current state of the code is not going to be kept in the long term.

@codeofdusk codeofdusk marked this pull request as draft July 21, 2025 01:38
@codeofdusk codeofdusk force-pushed the native-dmp branch 3 times, most recently from 959b3b0 to 360a372 Compare July 21, 2025 02:29
@codeofdusk codeofdusk changed the title Add a native implementation of diff-match-patch Remove nvda_dmp in favour of an integrated implementation Jul 21, 2025
@codeofdusk codeofdusk changed the title Remove nvda_dmp in favour of an integrated implementation Replace nvda_dmp with an integrated implementation Jul 21, 2025
@codeofdusk codeofdusk marked this pull request as ready for review July 21, 2025 02:36
@codeofdusk

Copy link
Copy Markdown
Contributor Author

@seanbudd nvda_dmp has been completely removed.

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @codeofdusk

@seanbudd seanbudd merged commit b73f6c4 into nvaccess:master Jul 21, 2025
18 of 20 checks passed
@SaschaCowley SaschaCowley added this to the 2025.3 milestone Aug 18, 2025
@SaschaCowley SaschaCowley mentioned this pull request Nov 28, 2025
5 tasks
seanbudd pushed a commit that referenced this pull request Nov 30, 2025
follow-up #18480
follow-up #19105
Follow-up #19196
Summary of the issue:

Commit references in projectDocs/dev/createDevEnvironment.md were out of date.

There were also references to nvda_dmp and the old ftd2xx.py.
Description of user facing changes:

None
Description of developer facing changes:

Description of runtime submodules now more accurately reflects reality.
Description of development approach:

Updated commit references and removed outdated items.
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.

Reconsider fast_diff_match_path license violation workaround

5 participants