EasyDiff icon indicating copy to clipboard operation
EasyDiff copied to clipboard

"Compare Both" throws TypeError if run before "Set Left Side" has ever been used

Open dpc00 opened this issue 2 months ago • 1 comments

What happens

easy_diff_basic.py keeps the left-hand comparison side in a module-level global:

LEFT = None
...
class EasyDiffCompareBothCommand(...):
    def get_left(self):
        if self.clipboard:
            left = {...}
        else:
            left = LEFT
        return left

and the top-level diff() function immediately does left["win_id"] on whatever get_left() returns. If "Compare Both" is run before "Set Left Side" has ever been used in the session (a plausible first-use mistake, or just picking the wrong menu item), LEFT is still None, and indexing into it throws:

TypeError: 'NoneType' object is not subscriptable

Repro steps

  1. Install EasyDiff (or restart Sublime with it installed, so LEFT is freshly None).
  2. Run "Compare Both" (not "Compare Left/Right", and without ever running "Set Left Side" first) on any file.
  3. The traceback above should appear.

This is based on a direct source read of easy_diff_basic.py (the code path is unambiguous: LEFT starts None, get_left() returns it unchanged, diff() indexes into it immediately) — a live capture of the exact traceback on this end was interrupted by an unrelated local environment issue, so please treat this as a strong, source-grounded report rather than an observed-live one, and let me know if it doesn't reproduce as described.

Suggested fix

Have EasyDiffCompareBothCommand.run() check LEFT is not None (or that get_left() returned something non-None) before calling diff(), and show a status message like "Set a left side first" otherwise — matching the existing is_enabled/panel_enable_check gating already used for the quick-panel menu entries.

dpc00 avatar Sep 14 '26 21:09 dpc00

Claude reports: closing this after 30 days with no response. Reopen it if it is still relevant.

dpc00 avatar Oct 27 '26 19:10 dpc00