summaryrefslogtreecommitdiff
path: root/bin/icli
diff options
context:
space:
mode:
Diffstat (limited to 'bin/icli')
-rwxr-xr-xbin/icli13
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/icli b/bin/icli
index 2c80c23..8b8ef69 100755
--- a/bin/icli
+++ b/bin/icli
@@ -143,14 +143,21 @@ sub break_str {
my ($text, $waste) = @_;
my $cut = $term_width - $waste;
+ if (
+ (not defined $term_width) or
+ ($term_width == 0) or
+ ($cut < 12)) {
+ return $text;
+ }
+
if ($cut_mode eq 'c') {
- return(substr($text, 0, $cut));
+ return substr($text, 0, $cut);
}
elsif ($cut_mode eq 'b') {
- return(join("\n", split_by_words($text, $waste, $cut)));
+ return join("\n", split_by_words($text, $waste, $cut));
}
else {
- return($text);
+ return $text;
}
}