|
@@ -296,7 +296,7 @@ internal class TextModel
|
|
RuneCell? cell = RuneAt (col, row);
|
|
RuneCell? cell = RuneAt (col, row);
|
|
Rune rune;
|
|
Rune rune;
|
|
|
|
|
|
- if (cell != null)
|
|
|
|
|
|
+ if (cell is { })
|
|
{
|
|
{
|
|
rune = cell.Rune;
|
|
rune = cell.Rune;
|
|
}
|
|
}
|
|
@@ -1328,7 +1328,7 @@ internal partial class HistoryText
|
|
{
|
|
{
|
|
HistoryTextItem? found = _historyTextItems.FindLast (x => x.LineStatus == lineStatus);
|
|
HistoryTextItem? found = _historyTextItems.FindLast (x => x.LineStatus == lineStatus);
|
|
|
|
|
|
- if (found != null)
|
|
|
|
|
|
+ if (found is { })
|
|
{
|
|
{
|
|
found.Lines = lines;
|
|
found.Lines = lines;
|
|
found.CursorPosition = curPos;
|
|
found.CursorPosition = curPos;
|
|
@@ -2744,7 +2744,7 @@ public class TextView : View
|
|
|
|
|
|
SetNeedsDisplay ();
|
|
SetNeedsDisplay ();
|
|
}
|
|
}
|
|
- else if (_multiline && _savedHeight != null)
|
|
|
|
|
|
+ else if (_multiline && _savedHeight is { })
|
|
{
|
|
{
|
|
//var lyout = LayoutStyle;
|
|
//var lyout = LayoutStyle;
|
|
//if (LayoutStyle == LayoutStyle.Computed) {
|
|
//if (LayoutStyle == LayoutStyle.Computed) {
|
|
@@ -2932,7 +2932,7 @@ public class TextView : View
|
|
_wrapManager = new WordWrapManager (_model);
|
|
_wrapManager = new WordWrapManager (_model);
|
|
_model = _wrapManager.WrapModel (_frameWidth, out _, out _, out _, out _);
|
|
_model = _wrapManager.WrapModel (_frameWidth, out _, out _, out _, out _);
|
|
}
|
|
}
|
|
- else if (!_wordWrap && _wrapManager != null)
|
|
|
|
|
|
+ else if (!_wordWrap && _wrapManager is { })
|
|
{
|
|
{
|
|
_model = _wrapManager.Model;
|
|
_model = _wrapManager.Model;
|
|
}
|
|
}
|
|
@@ -3529,7 +3529,7 @@ public class TextView : View
|
|
|
|
|
|
newPos = _model.WordForward (CurrentColumn, CurrentRow);
|
|
newPos = _model.WordForward (CurrentColumn, CurrentRow);
|
|
|
|
|
|
- if (newPos != null && newPos.HasValue)
|
|
|
|
|
|
+ if (newPos is { } && newPos.HasValue)
|
|
{
|
|
{
|
|
CurrentColumn = CurrentRow == newPos.Value.row ? newPos.Value.col : line.Count;
|
|
CurrentColumn = CurrentRow == newPos.Value.row ? newPos.Value.col : line.Count;
|
|
}
|
|
}
|
|
@@ -3737,7 +3737,7 @@ public class TextView : View
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|
|
public override bool OnLeave (View view)
|
|
public override bool OnLeave (View view)
|
|
{
|
|
{
|
|
- if (Application.MouseGrabView != null && Application.MouseGrabView == this)
|
|
|
|
|
|
+ if (Application.MouseGrabView is { } && Application.MouseGrabView == this)
|
|
{
|
|
{
|
|
Application.UngrabMouse ();
|
|
Application.UngrabMouse ();
|
|
}
|
|
}
|
|
@@ -4028,7 +4028,7 @@ public class TextView : View
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
DrawNormalColor?.Invoke (this, ev);
|
|
DrawNormalColor?.Invoke (this, ev);
|
|
|
|
|
|
- if (line [idxCol].ColorScheme != null)
|
|
|
|
|
|
+ if (line [idxCol].ColorScheme is { })
|
|
{
|
|
{
|
|
ColorScheme? colorScheme = line [idxCol].ColorScheme;
|
|
ColorScheme? colorScheme = line [idxCol].ColorScheme;
|
|
Driver.SetAttribute (Enabled ? colorScheme!.Focus : colorScheme!.Disabled);
|
|
Driver.SetAttribute (Enabled ? colorScheme!.Focus : colorScheme!.Disabled);
|
|
@@ -4054,7 +4054,7 @@ public class TextView : View
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
DrawReadOnlyColor?.Invoke (this, ev);
|
|
DrawReadOnlyColor?.Invoke (this, ev);
|
|
|
|
|
|
- ColorScheme? colorScheme = line [idxCol].ColorScheme != null ? line [idxCol].ColorScheme : ColorScheme;
|
|
|
|
|
|
+ ColorScheme? colorScheme = line [idxCol].ColorScheme is { } ? line [idxCol].ColorScheme : ColorScheme;
|
|
Attribute attribute;
|
|
Attribute attribute;
|
|
|
|
|
|
if (colorScheme!.Disabled.Foreground == colorScheme.Focus.Background)
|
|
if (colorScheme!.Disabled.Foreground == colorScheme.Focus.Background)
|
|
@@ -4084,7 +4084,7 @@ public class TextView : View
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
DrawSelectionColor?.Invoke (this, ev);
|
|
DrawSelectionColor?.Invoke (this, ev);
|
|
|
|
|
|
- if (line [idxCol].ColorScheme != null)
|
|
|
|
|
|
+ if (line [idxCol].ColorScheme is { })
|
|
{
|
|
{
|
|
ColorScheme? colorScheme = line [idxCol].ColorScheme;
|
|
ColorScheme? colorScheme = line [idxCol].ColorScheme;
|
|
|
|
|
|
@@ -4118,7 +4118,7 @@ public class TextView : View
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
|
|
DrawUsedColor?.Invoke (this, ev);
|
|
DrawUsedColor?.Invoke (this, ev);
|
|
|
|
|
|
- if (line [idxCol].ColorScheme != null)
|
|
|
|
|
|
+ if (line [idxCol].ColorScheme is { })
|
|
{
|
|
{
|
|
ColorScheme? colorScheme = line [idxCol].ColorScheme;
|
|
ColorScheme? colorScheme = line [idxCol].ColorScheme;
|
|
SetValidUsedColor (colorScheme!);
|
|
SetValidUsedColor (colorScheme!);
|
|
@@ -4742,11 +4742,11 @@ public class TextView : View
|
|
{
|
|
{
|
|
SetWrapModel ();
|
|
SetWrapModel ();
|
|
|
|
|
|
- if (obj != null)
|
|
|
|
|
|
+ if (obj is { })
|
|
{
|
|
{
|
|
int startLine = obj.CursorPosition.Y;
|
|
int startLine = obj.CursorPosition.Y;
|
|
|
|
|
|
- if (obj.RemovedOnAdded != null)
|
|
|
|
|
|
+ if (obj.RemovedOnAdded is { })
|
|
{
|
|
{
|
|
int offset;
|
|
int offset;
|
|
|
|
|
|
@@ -4908,7 +4908,7 @@ public class TextView : View
|
|
addedLines.Add (new List<RuneCell> (lines [i]));
|
|
addedLines.Add (new List<RuneCell> (lines [i]));
|
|
}
|
|
}
|
|
|
|
|
|
- if (rest != null)
|
|
|
|
|
|
+ if (rest is { })
|
|
{
|
|
{
|
|
List<RuneCell> last = _model.GetLine (CurrentRow + lines.Count - 1);
|
|
List<RuneCell> last = _model.GetLine (CurrentRow + lines.Count - 1);
|
|
lastp = last.Count;
|
|
lastp = last.Count;
|
|
@@ -4921,7 +4921,7 @@ public class TextView : View
|
|
|
|
|
|
// Now adjust column and row positions
|
|
// Now adjust column and row positions
|
|
CurrentRow += lines.Count - 1;
|
|
CurrentRow += lines.Count - 1;
|
|
- CurrentColumn = rest != null ? lastp : lines [lines.Count - 1].Count;
|
|
|
|
|
|
+ CurrentColumn = rest is { } ? lastp : lines [lines.Count - 1].Count;
|
|
Adjust ();
|
|
Adjust ();
|
|
|
|
|
|
_historyText.Add (
|
|
_historyText.Add (
|
|
@@ -5424,7 +5424,7 @@ public class TextView : View
|
|
|
|
|
|
private bool MoveNextView ()
|
|
private bool MoveNextView ()
|
|
{
|
|
{
|
|
- if (Application.OverlappedTop != null)
|
|
|
|
|
|
+ if (Application.OverlappedTop is { })
|
|
{
|
|
{
|
|
return SuperView?.FocusNext () == true;
|
|
return SuperView?.FocusNext () == true;
|
|
}
|
|
}
|
|
@@ -5490,7 +5490,7 @@ public class TextView : View
|
|
|
|
|
|
private bool MovePreviousView ()
|
|
private bool MovePreviousView ()
|
|
{
|
|
{
|
|
- if (Application.OverlappedTop != null)
|
|
|
|
|
|
+ if (Application.OverlappedTop is { })
|
|
{
|
|
{
|
|
return SuperView?.FocusPrev () == true;
|
|
return SuperView?.FocusPrev () == true;
|
|
}
|
|
}
|
|
@@ -5760,7 +5760,7 @@ public class TextView : View
|
|
RuneCell cell = line [colWithColor];
|
|
RuneCell cell = line [colWithColor];
|
|
int colWithoutColor = Math.Max (col - 1, 0);
|
|
int colWithoutColor = Math.Max (col - 1, 0);
|
|
|
|
|
|
- if (cell.ColorScheme != null && colWithColor == 0 && lineToSet [colWithoutColor].ColorScheme != null)
|
|
|
|
|
|
+ if (cell.ColorScheme is { } && colWithColor == 0 && lineToSet [colWithoutColor].ColorScheme is { })
|
|
{
|
|
{
|
|
for (int r = row - 1; r > -1; r--)
|
|
for (int r = row - 1; r > -1; r--)
|
|
{
|
|
{
|
|
@@ -5793,7 +5793,7 @@ public class TextView : View
|
|
rc => rc.ColorScheme != null
|
|
rc => rc.ColorScheme != null
|
|
);
|
|
);
|
|
|
|
|
|
- if (colWithColor > -1 && l [colWithColor].ColorScheme != null)
|
|
|
|
|
|
+ if (colWithColor > -1 && l [colWithColor].ColorScheme is { })
|
|
{
|
|
{
|
|
cell = l [colWithColor];
|
|
cell = l [colWithColor];
|
|
|
|
|
|
@@ -5820,7 +5820,7 @@ public class TextView : View
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (cell.ColorScheme != null && colWithColor > -1 && colWithoutColor < lineToSet.Count && lineToSet [colWithoutColor].ColorScheme is null)
|
|
|
|
|
|
+ if (cell.ColorScheme is { } && colWithColor > -1 && colWithoutColor < lineToSet.Count && lineToSet [colWithoutColor].ColorScheme is null)
|
|
{
|
|
{
|
|
while (lineToSet [colWithoutColor].ColorScheme is null)
|
|
while (lineToSet [colWithoutColor].ColorScheme is null)
|
|
{
|
|
{
|
|
@@ -6288,7 +6288,7 @@ public class TextView : View
|
|
|
|
|
|
private void SetClipboard (string text)
|
|
private void SetClipboard (string text)
|
|
{
|
|
{
|
|
- if (text != null)
|
|
|
|
|
|
+ if (text is { })
|
|
{
|
|
{
|
|
Clipboard.Contents = text;
|
|
Clipboard.Contents = text;
|
|
}
|
|
}
|
|
@@ -6362,7 +6362,7 @@ public class TextView : View
|
|
/// <summary>Restore from original model.</summary>
|
|
/// <summary>Restore from original model.</summary>
|
|
private void SetWrapModel ([CallerMemberName] string? caller = null)
|
|
private void SetWrapModel ([CallerMemberName] string? caller = null)
|
|
{
|
|
{
|
|
- if (_currentCaller != null)
|
|
|
|
|
|
+ if (_currentCaller is { })
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -6442,7 +6442,7 @@ public class TextView : View
|
|
{
|
|
{
|
|
Autocomplete.HostControl = this;
|
|
Autocomplete.HostControl = this;
|
|
|
|
|
|
- if (Application.Top != null)
|
|
|
|
|
|
+ if (Application.Top is { })
|
|
{
|
|
{
|
|
Application.Top.AlternateForwardKeyChanged += Top_AlternateForwardKeyChanged!;
|
|
Application.Top.AlternateForwardKeyChanged += Top_AlternateForwardKeyChanged!;
|
|
Application.Top.AlternateBackwardKeyChanged += Top_AlternateBackwardKeyChanged!;
|
|
Application.Top.AlternateBackwardKeyChanged += Top_AlternateBackwardKeyChanged!;
|
|
@@ -6493,7 +6493,7 @@ public class TextView : View
|
|
/// <summary>Update the original model.</summary>
|
|
/// <summary>Update the original model.</summary>
|
|
private void UpdateWrapModel ([CallerMemberName] string? caller = null)
|
|
private void UpdateWrapModel ([CallerMemberName] string? caller = null)
|
|
{
|
|
{
|
|
- if (_currentCaller != null && _currentCaller != caller)
|
|
|
|
|
|
+ if (_currentCaller is { } && _currentCaller != caller)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -6523,7 +6523,7 @@ public class TextView : View
|
|
SetNeedsDisplay ();
|
|
SetNeedsDisplay ();
|
|
}
|
|
}
|
|
|
|
|
|
- if (_currentCaller != null)
|
|
|
|
|
|
+ if (_currentCaller is { })
|
|
{
|
|
{
|
|
throw new InvalidOperationException (
|
|
throw new InvalidOperationException (
|
|
$"WordWrap settings was changed after the {_currentCaller} call."
|
|
$"WordWrap settings was changed after the {_currentCaller} call."
|
|
@@ -6533,7 +6533,7 @@ public class TextView : View
|
|
|
|
|
|
private void WrapTextModel ()
|
|
private void WrapTextModel ()
|
|
{
|
|
{
|
|
- if (_wordWrap && _wrapManager != null)
|
|
|
|
|
|
+ if (_wordWrap && _wrapManager is { })
|
|
{
|
|
{
|
|
_model = _wrapManager.WrapModel (
|
|
_model = _wrapManager.WrapModel (
|
|
_frameWidth,
|
|
_frameWidth,
|