Skip to content

Commit

Permalink
Fix handling of operand wrap len == 0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fadden committed Jul 9, 2024
1 parent ba9d6e7 commit b913541
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Asm65/Formatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public class FormatConfig {
//

/// <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>
public bool SpacesBetweenBytes { get; set; } = false; // "20edfd" vs. "20 ed fd"
Expand All @@ -137,14 +137,14 @@ public enum CharConvMode {
C64ScreenCode
};
/// <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 };
/// <summary>
/// This determines what operators are available and what their precedence is. Used
/// when generating expressions for operands.
/// </summary>
public ExpressionMode ExprMode = ExpressionMode.Unknown;
public ExpressionMode ExprMode { get; set; } = ExpressionMode.Unknown;


/// <summary>
Expand Down Expand Up @@ -569,7 +569,8 @@ public FormatConfig.ExpressionMode ExpressionMode {
/// Point at which to wrap long operands, such as strings and dense hex.
/// </summary>
public int OperandWrapLen {
get { return mFormatConfig.OperandWrapLen; }
get { return mFormatConfig.OperandWrapLen == 0 ?
DEFAULT_OPERAND_WRAP_LEN : mFormatConfig.OperandWrapLen; }
}


Expand Down

0 comments on commit b913541

Please sign in to comment.