1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use super::*;

impl std::cmp::PartialEq for EdError {
  fn eq(&self, other: &Self) -> bool {
    use EdError::*;
    match (self, other) {
      (Internal(x),Internal(y)) => x == y,
      (IO(_),IO(_)) => true,
      (UI(_),UI(_)) => true,

      (InfiniteRecursion, InfiniteRecursion) => true,

      (
        IndexTooBig{index: a, buffer_len: b},
        IndexTooBig{index: c, buffer_len: d},
      ) => {
        a == c && b == d
      },
      (Line0Invalid,Line0Invalid) => true,
      (SelectionEmpty((a,b)),SelectionEmpty((c,d))) => a == c && b == d,
      (SelectionForbidden,SelectionForbidden) => true,

      (UnsavedChanges,UnsavedChanges) => true,
      (NoOp,NoOp) => true,
      (
        UndoIndexTooBig{index: a, history_len: b, relative_redo_limit: c},
        UndoIndexTooBig{index: d, history_len: e, relative_redo_limit: f},
      ) => {
        a == d && b == e && c == f
      },
      (CommandEscapeForbidden(x),CommandEscapeForbidden(y)) => x == y,
      (TagInvalid(x),TagInvalid(y)) => x == y,
      (TagNoMatch(x),TagNoMatch(y)) => x == y,
      (
        RegexInvalid{regex: a, error: b},
        RegexInvalid{regex: c, error: d},
      ) => {
        a == c && b == d
      },
      (RegexNoMatch(x),RegexNoMatch(y)) => x == y,
      (PrintAfterWipe,PrintAfterWipe) => true,

      (DefaultFileUnset,DefaultFileUnset) => true,
      (DefaultShellCommandUnset,DefaultShellCommandUnset) => true,
      (DefaultSArgsUnset,DefaultSArgsUnset) => true,

      (
        IndexSpecialAfterStart{prior_index: a, special_index: b},
        IndexSpecialAfterStart{prior_index: c, special_index: d},
      ) => {
        a == c && b == d
      },
      (IndexNotInt(x),IndexNotInt(y)) => x == y,
      (OffsetNotInt(x),OffsetNotInt(y)) => x == y,
      (
        IndicesUnrelated{prior_index: a, unrelated_index: b},
        IndicesUnrelated{prior_index: c, unrelated_index: d},
      ) => {
        a == c && b == d
      },
      (IndexUnfinished(x),IndexUnfinished(y)) => x == y,

      (CommandUndefined(x),CommandUndefined(y)) => x == y,
      (ArgumentListEscapedEnd(x),ArgumentListEscapedEnd(y)) => x == y,
      (
        ArgumentsWrongNr{expected: a, received: b},
        ArgumentsWrongNr{expected: c, received: d},
      ) => {
        a == c && b == d
      },
      (ScrollNotInt(x),ScrollNotInt(y)) => x == y,
      (UndoStepsNotInt(x),UndoStepsNotInt(y)) => x == y,
      (ReflowNotInt{error: a, text: b},ReflowNotInt{error: c, text: d}) => {
        a == c && b == d
      },
      (MacroUndefined(x),MacroUndefined(y)) => x == y,

      (FlagDuplicate(x),FlagDuplicate(y)) => x == y,
      (FlagUndefined(x),FlagUndefined(y)) => x == y,

      _ => false,
    }
  }
}