top: add intra-column horizontal scrolling

This commit introduces horizontal scrolling within any
variable width column.  Thus, an entire command line,
complete list of control groups, etc. can now be
viewed -- not just a screen width's portion.

It is activated when any variable width column:
 . is (via field selection) or
 . has become (via the right arrow key)
the only displayed field.

Then, the right and left arrow keys can be used in the
normal way to continue scrolling within that column.

The amount scrolled with each key press is currently
set as the normal tab stop increment of 8 characters.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2012-06-30 00:00:00 -05:00
committed by Craig Small
parent f4666e1743
commit a652ba8c9d
2 changed files with 110 additions and 11 deletions

View File

@@ -39,6 +39,7 @@
//#define PRETENDNOCAP /* use a terminal without essential caps */
//#define RCFILE_NOERR /* rcfile errs silently default, vs. fatal */
//#define RMAN_IGNORED /* don't consider auto right margin glitch */
//#define SCROLLVAR_NO /* disable intra-column horizontal scroll */
//#define STRINGCASENO /* case insenstive compare/locate versions */
//#define TERMIO_PROXY /* true line editing, beyond native input */
//#define TREE_NORESET /* sort keys do NOT force forest view OFF */
@@ -331,6 +332,9 @@ typedef struct WIN_t {
begpflg, // scrolled beginning pos into pflgsall array
endpflg, // scrolled ending pos into pflgsall array
begtask, // scrolled beginning pos into Frame_maxtask
#ifndef SCROLLVAR_NO
varcolbeg, // scrolled position within variable width col
#endif
varcolsz, // max length of variable width column(s)
usrseluid, // validated uid for 'u/U' user selection
usrseltyp, // the basis for matching above uid
@@ -379,6 +383,18 @@ typedef struct WIN_t {
#define ENUviz(w,E) (NULL != memchr((w)->procflgs, E, (w)->maxpflgs))
#define ENUpos(w,E) ((int)((FLG_t*)memchr((w)->pflgsall, E, (w)->totpflgs) - (w)->pflgsall))
// Support for variable width columns (and potentially scrolling too)
#define VARcol(E) (NULL == Fieldstab[E].fmts)
#ifndef SCROLLVAR_NO
#ifdef USE_X_COLHDR
#define VARright(w) (1 == w->maxpflgs && VARcol(w->procflgs[0]))
#else
#define VARright(w) ((1 == w->maxpflgs && VARcol(w->procflgs[0])) || \
(3 == w->maxpflgs && X_XON == w->procflgs[0] && VARcol(w->procflgs[1])))
#endif
#define VARleft(w) (w->varcolbeg && VARright(w))
#define SCROLLAMT 8
#endif
/* Special Section: end ------------------------------------------ */
/* /////////////////////////////////////////////////////////////// */