1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-01 22:50:35 +00:00

Fix handling of operand wrap len == 0

This was supposed to select the default wrap length, but was actually
returning zero, causing a crash when a project was opened if the
settings file didn't happen to have the value specified.
This commit is contained in:
Andy McFadden 2024-07-09 16:08:57 -07:00
parent ba9d6e7924
commit b913541da4

View File

@ -119,7 +119,7 @@ namespace Asm65 {
// //
/// <summary>Character position at which operands wrap; 0 == default.</summary> /// <summary>Character position at which operands wrap; 0 == default.</summary>
public int OperandWrapLen = DEFAULT_OPERAND_WRAP_LEN; public int OperandWrapLen { get; set; } = 0;
/// <summary>Add spaces between bytes in the Bytes column?</summary> /// <summary>Add spaces between bytes in the Bytes column?</summary>
public bool SpacesBetweenBytes { get; set; } = false; // "20edfd" vs. "20 ed fd" public bool SpacesBetweenBytes { get; set; } = false; // "20edfd" vs. "20 ed fd"
@ -137,14 +137,14 @@ namespace Asm65 {
C64ScreenCode C64ScreenCode
}; };
/// <summary>Character conversion mode for hex dumps.</summary> /// <summary>Character conversion mode for hex dumps.</summary>
public CharConvMode HexDumpCharConvMode = CharConvMode.Unknown; public CharConvMode HexDumpCharConvMode { get; set; } = CharConvMode.Unknown;
public enum ExpressionMode { Unknown = 0, Common, Cc65, Merlin }; public enum ExpressionMode { Unknown = 0, Common, Cc65, Merlin };
/// <summary> /// <summary>
/// This determines what operators are available and what their precedence is. Used /// This determines what operators are available and what their precedence is. Used
/// when generating expressions for operands. /// when generating expressions for operands.
/// </summary> /// </summary>
public ExpressionMode ExprMode = ExpressionMode.Unknown; public ExpressionMode ExprMode { get; set; } = ExpressionMode.Unknown;
/// <summary> /// <summary>
@ -569,7 +569,8 @@ namespace Asm65 {
/// Point at which to wrap long operands, such as strings and dense hex. /// Point at which to wrap long operands, such as strings and dense hex.
/// </summary> /// </summary>
public int OperandWrapLen { public int OperandWrapLen {
get { return mFormatConfig.OperandWrapLen; } get { return mFormatConfig.OperandWrapLen == 0 ?
DEFAULT_OPERAND_WRAP_LEN : mFormatConfig.OperandWrapLen; }
} }