diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/java/PsychEmitter.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/java/PsychEmitter.java b/ext/java/PsychEmitter.java index d9f3231..35eff96 100644 --- a/ext/java/PsychEmitter.java +++ b/ext/java/PsychEmitter.java @@ -101,7 +101,7 @@ public class PsychEmitter extends RubyObject { options.setCanonical(canonical.isTrue()); options.setIndent((int)level.convertToInteger().getLongValue()); - options.setWidth((int)width.convertToInteger().getLongValue()); + line_width_set(context, width); this.io = io; @@ -296,7 +296,9 @@ public class PsychEmitter extends RubyObject { @JRubyMethod(name = "line_width=") public IRubyObject line_width_set(ThreadContext context, IRubyObject width) { - options.setWidth((int)width.convertToInteger().getLongValue()); + int newWidth = (int)width.convertToInteger().getLongValue(); + if (newWidth <= 0) newWidth = Integer.MAX_VALUE; + options.setWidth(newWidth); return width; } |