From c9bb993ebd79a02b74691cb868fff76dcf3c2ea3 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 2 Jun 2021 04:03:28 -0400 Subject: [PATCH] Use Diff Match Patch by default when available (#12485) Diff Match Patch (DMP) was included but disabled by default in 2021.1. It fixes #3200 and allows for drastically fewer cross-process calls in UIA console, improving performance in busy applications. This PR enables DMP by default to allow for wider user testing in master snapshots. If user feedback is positive, use by default in 2021.2. --- source/diffHandler.py | 11 +++++------ source/gui/settingsDialogs.py | 2 +- user_docs/en/changes.t2t | 3 +++ user_docs/en/userGuide.t2t | 5 ++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/diffHandler.py b/source/diffHandler.py index 4bacff6ae38..dafb487ce95 100644 --- a/source/diffHandler.py +++ b/source/diffHandler.py @@ -174,14 +174,13 @@ def _getText(self, ti: TextInfo) -> str: def get_dmp_algo(): """ This function returns a Diff Match Patch object if allowed by the user. - DMP is experimental and can be explicitly enabled/disabled by a user - setting to opt in or out of the experiment. If config does not allow - DMP, this function returns a Difflib instance instead. + DMP is new and can be explicitly disabled by a user setting. If config + does not allow DMP, this function returns a Difflib instance instead. """ return ( - _dmp - if config.conf["terminals"]["diffAlgo"] == "dmp" - else _difflib + _difflib + if config.conf["terminals"]["diffAlgo"] == "difflib" + else _dmp ) diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index e5231d70e3a..371ff6db7bb 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -2681,7 +2681,7 @@ def __init__(self, parent): # Translators: A choice in a combo box in the advanced settings # panel to have NVDA determine the method of detecting changed # content in terminals automatically. - _("Automatic (Difflib)"), + _("Automatic (Diff Match Patch)"), # Translators: A choice in a combo box in the advanced settings # panel to have NVDA detect changes in terminals # by character when supported, using the diff match patch algorithm. diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index 202e92e542b..d4daf5014a4 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -18,6 +18,9 @@ What's New in NVDA == Bug Fixes == - In Windows 10 Calculator, NVDA will announce calculator expressions on a braille display. (#12268) +- In terminal programs on Windows 10 version 1607 and later, when inserting or deleting characters in the middle of a line, the characters to the right of the caret are no longer read out. (#3200) + - Diff Match Patch now enabled by default. (#12485) + - - diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 0877fdf7878..b08843e4a3f 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1875,11 +1875,10 @@ In untrusted environments, you may temporarily disable [speak typed characters # ==== Diff algorithm ====[DiffAlgo] This setting controls how NVDA determines the new text to speak in terminals. The diff algorithm combo box has three options: -- Automatic: as of NVDA 2021.1, this option is equivalent to Difflib. -In a future release, it may be changed to Diff Match Patch pending positive user testing. +- Automatic: as of NVDA 2021.2, this option is equivalent to "allow Diff Match Patch". - allow Diff Match Patch: This option causes NVDA to calculate changes to terminal text by character. It may improve performance when large volumes of text are written to the console and allow more accurate reporting of changes made in the middle of lines. -However, it may be incompatible with some applications. +However, it may be incompatible with some applications, so Diff Match Patch is not always used. This feature is supported in Windows Console on Windows 10 versions 1607 and later. Additionally, it may be available in other terminals on earlier Windows releases. - force Difflib: this option causes NVDA to calculate changes to terminal text by line.