Skip to content

Commit 8413b67

Browse files
Code cleaning
1 parent 145c93a commit 8413b67

1 file changed

Lines changed: 18 additions & 25 deletions

File tree

CompressedFileViewer/PluginInfrastructure/GatewayDomain.cs

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ public Colour(int red, int green, int blue)
5555
/// If you use messages, there is nothing to stop you setting a position that is in the middle of a CRLF pair, or in the middle of a 2 byte character.
5656
/// However, keyboard commands will not move the caret into such positions.
5757
/// </summary>
58-
public class Position : IEquatable<Position>
58+
public class Position(int pos) : IEquatable<Position>
5959
{
60-
public Position(int pos) => Value = pos;
61-
62-
public int Value { get; }
60+
public int Value { get; } = pos;
6361

6462
public static Position operator +(Position a, Position b) => new(a.Value + b.Value);
6563

@@ -97,37 +95,32 @@ public class Position : IEquatable<Position>
9795
/// On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META.SCMOD_SUPER is only available on GTK+ which is commonly the Windows key.
9896
/// If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers.
9997
/// </summary>
100-
public class KeyModifier
98+
/// <remarks>
99+
/// The key code is a visible or control character or a key from the SCK_* enumeration, which contains:
100+
/// SCK_ADD, SCK_BACK, SCK_DELETE, SCK_DIVIDE, SCK_DOWN, SCK_END, SCK_ESCAPE, SCK_HOME, SCK_INSERT, SCK_LEFT, SCK_MENU, SCK_NEXT(Page Down), SCK_PRIOR(Page Up),
101+
/// SCK_RETURN, SCK_RIGHT, SCK_RWIN, SCK_SUBTRACT, SCK_TAB, SCK_UP, and SCK_WIN.
102+
///
103+
/// The modifiers are a combination of zero or more of SCMOD_ALT, SCMOD_CTRL, SCMOD_SHIFT, SCMOD_META, and SCMOD_SUPER.
104+
/// On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META.SCMOD_SUPER is only available on GTK+ which is commonly the Windows key.
105+
/// If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers.
106+
/// </remarks>
107+
public class KeyModifier(SciMsg SCK_KeyCode, SciMsg SCMOD_modifier)
101108
{
102-
private readonly int value;
103-
104-
/// <summary>
105-
/// The key code is a visible or control character or a key from the SCK_* enumeration, which contains:
106-
/// SCK_ADD, SCK_BACK, SCK_DELETE, SCK_DIVIDE, SCK_DOWN, SCK_END, SCK_ESCAPE, SCK_HOME, SCK_INSERT, SCK_LEFT, SCK_MENU, SCK_NEXT(Page Down), SCK_PRIOR(Page Up),
107-
/// SCK_RETURN, SCK_RIGHT, SCK_RWIN, SCK_SUBTRACT, SCK_TAB, SCK_UP, and SCK_WIN.
108-
///
109-
/// The modifiers are a combination of zero or more of SCMOD_ALT, SCMOD_CTRL, SCMOD_SHIFT, SCMOD_META, and SCMOD_SUPER.
110-
/// On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META.SCMOD_SUPER is only available on GTK+ which is commonly the Windows key.
111-
/// If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers.
112-
/// </summary>
113-
public KeyModifier(SciMsg SCK_KeyCode, SciMsg SCMOD_modifier) => value = (int)SCK_KeyCode | ((int)SCMOD_modifier << 16);
109+
private readonly int value = (int)SCK_KeyCode | ((int)SCMOD_modifier << 16);
114110

115111
public int Value => Value;
116112
}
117113

118114
[StructLayout(LayoutKind.Sequential)]
119-
public struct CharacterRange
115+
public struct CharacterRange(int cpmin, int cpmax)
120116
{
121-
public CharacterRange(int cpmin, int cpmax) { cpMin = cpmin; cpMax = cpmax; }
122-
public int cpMin;
123-
public int cpMax;
117+
public int cpMin = cpmin;
118+
public int cpMax = cpmax;
124119
}
125120

126-
public class Cells
121+
public class Cells(char[] charactersAndStyles)
127122
{
128-
public Cells(char[] charactersAndStyles) => Value = charactersAndStyles;
129-
130-
public char[] Value { get; }
123+
public char[] Value { get; } = charactersAndStyles;
131124
}
132125

133126
public class TextRange : IDisposable

0 commit comments

Comments
 (0)