|
Bugzilla – Full Text Bug Listing |
| Summary: | zypper: progress bar does not redraw properly if window is smaller than text | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE 11.4 | Reporter: | Andreas Jaeger <aj> |
| Component: | libzypp | Assignee: | Dominik Heidler <dheidler> |
| Status: | RESOLVED FIXED | QA Contact: | Stanislav Visnovsky <visnov> |
| Severity: | Minor | ||
| Priority: | P4 - Low | CC: | dheidler, dmacvicar, francis, jsrain, mvidner, werner |
| Version: | Factory | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
|
Description
Andreas Jaeger
2007-08-24 11:59:53 UTC
Yes, a known issue. Any hints how to fix it anyone? The CR character does not do its trick when the line is written over multiple console lines. To use COLUMNS environment variable to limit the size? Hm. I would cut the output to fit the width only as a last resort... But COLUMNS is a shell variable, and as such is not automatically visible to processes (AFAIK). How to get it into or read it from zypper? Use e.g.:
columns = getenv ("COLUMNS");
for details: man 3 getenv
Andreas, COLUMNS is not an environment variable. getenv() will not get it, if it wasn't exported before zypper started. And even then, you won't get actual value if you resize your xterm on-the-fly. Jan, you're right. Let's delete comments 4 and 5 ;-) Werner, can you help us? Simply switch the console into bold mode, e.g. on the prompt one can do this with /suse/werner> tput bold The escape sequence is simple \033[1m for the linux console. This can be done also in a C/C++ program with the help of ncurses, see e.g. manual page attrset(3ncurses) or wattrset(3ncurses), and the macros A_BOLD/WA_BOLD. Beside this ncurses uses well defined terminal settings. Thanks Werner :-) mvidner@valkyrie:~$ tput cols 178 delaying to openSUSE 11 FYI: The standard way to get the width is: 1) do a TIOCGWINSZ ioctl on fd 1 (this is what the stty command does, see also the tty_ioctl man page). If it succeeds and doesn't return 0 in the ws_col element, you have your width. 2) otherwise check the COLUMNS environment variable. If it is set and not zero, use it. 3) otherwise assume a line length of 80. (As Michael Matz just pointed out: if you're using readline, there's the rl_get_screen_size function) Also using ncurses is usable to get the width/height of the terminal screen called `stdscr' in ncurses. For this the macros found in the manual page getyx(3ncurses) can be used. Thanx Michaels :O) @Werener: i can imagine curses have lots of usefull stuff for terminal output, but zypper does not need most of them, so it would be a little bit too much to have to depend on ncruses because of few functions... *** Bug 458078 has been marked as a duplicate of this bug. *** still relevant in 11.4 fixed in zypper 1.5.6 (git commit 2d3e98311094aa503b50e1a2f6d10bb5bcf02d9c) |