top: lift the field management 6 col width restriction
When two somewhat cryptic error messages were recently changed to more user friendly text, the logic limiting maximum columns was left unchanged at six. This always was a rather arbitrary limit but now the revised error message could actually be misleading (ok, a huge lie). With a 1 line code change (macro actually), this patch lifts the internal restriction on maximum columns. Now the real limit is based on a window's physical x-axis. (everything is perfectly justified plus right margins) (are completely filled, but of course it must be luck) Reference(s): commit 5a27c8095ef015e9c40709ba3186422bdf3fc069 http://www.freelists.org/post/procps/top-won-the-sigwinch-war,6 Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
dedaf6e1a8
commit
ca76af22ca
21
top/top.c
21
top/top.c
@ -1835,20 +1835,21 @@ static void calibrate_fields (void) {
|
||||
* xPRFX ----------______________________ xSUFX
|
||||
* ( xPRFX has pos 2 & 10 for 'extending' when at minimums )
|
||||
*
|
||||
* The first 4 screen rows are reserved for explanatory text, the
|
||||
* maximum number of columns is currently 6 and a space is needed
|
||||
* between columns. Thus, for example, with 40 fields a tty will
|
||||
* The first 4 screen rows are reserved for explanatory text, and
|
||||
* the maximum number of columns is Screen_cols / xPRFX + 1 space
|
||||
* between columns. Thus, for example, with 42 fields a tty will
|
||||
* still remain useable under these extremes:
|
||||
* rows cols displayed
|
||||
* ---- ---- ------------------
|
||||
* 24 22 xPRFX only
|
||||
* 24 66 full xPRFX + xSUFX
|
||||
* 11 66 xPRFX only ( w/ room for +2 )
|
||||
* 11 198 full xPRFX + xSUFX ( w/ room for +2 )
|
||||
* rows columns what's
|
||||
* tty top tty top displayed
|
||||
* --- --- --- --- ------------------
|
||||
* 46 42 10 1 xPRFX only
|
||||
* 46 42 32 1 full xPRFX + xSUFX
|
||||
* 6 2 231 21 xPRFX only
|
||||
* 10 6 231 7 full xPRFX + xSUFX
|
||||
*/
|
||||
static void display_fields (int focus, int extend) {
|
||||
#define mkERR { putp("\n"); putp(N_txt(XTRA_winsize_txt)); return; }
|
||||
#define mxCOL 6
|
||||
#define mxCOL ( (Screen_cols / 11) > 0 ? (Screen_cols / 11) : 1 )
|
||||
#define yRSVD 4
|
||||
#define xSUFX 22
|
||||
#define xPRFX (10 + xadd)
|
||||
|
Loading…
x
Reference in New Issue
Block a user