Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
apps
DSerial
Commits
6bf438a9
Commit
6bf438a9
authored
Aug 23, 2015
by
Isabella Skořepová
Browse files
Proper terminal size detection & dont break line in s mode
parent
3d500465
Changes
1
Hide whitespace changes
Inline
Side-by-side
dserial-cli/src/commands/ReadCommand.vala
View file @
6bf438a9
...
...
@@ -56,7 +56,18 @@ public class ReadCommand : Object, Command
}
else
{
int
rows
;
int
cols
;
if
(!
state
.
interactive
)
Readline
.
initialize
();
Readline
.
get_screen_size
(
out
rows
,
out
cols
);
if
(
rows
==
0
||
cols
==
0
)
{
string
?
v
=
Environment
.
get_variable
(
"LINES"
);
if
(
v
!=
null
)
rows
=
int
.
parse
(
v
);
v
=
Environment
.
get_variable
(
"COLUMNS"
);
if
(
v
!=
null
)
cols
=
int
.
parse
(
v
);
}
if
(
rows
==
0
||
cols
==
0
)
{
rows
=
23
;
cols
=
80
;
}
int
chars_per
=
0
;
for
(
int
i
=
0
;
i
<
printers
.
length
;
i
++)
{
chars_per
+=
printers
[
i
].
width_per_char
;
...
...
@@ -97,7 +108,7 @@ public class ReadCommand : Object, Command
stdout
.
printf
(
" "
);
printers
[
x
].
a
(
tmpbuf
);
}
stdout
.
printf
(
"\n"
);
if
(
display_fields
!=
"s"
)
stdout
.
printf
(
"\n"
);
counter
=
0
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment