top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in place, the lack of highlighting in task based searches has grown from being only irritating to a real defect. Thus, this commit introduces parallel functionality to those searches initiated within a visible task window. And just as separate inspect searches are possible for each selection, per window task searches are provided. However, it should be noted that there are differences between task based searches and inspect type searches: * There is no concept of out-of-view data when dealing . with task rows -- if the data can't bee seen, it has . not, in fact, been constructed from a proc_t struct. * While inspect data is output at the character level, . up to now all task display data was only potentially . output and it was always based on a complete string. * With task search highlighting, rows now containing a . match must be output in pieces and, therefore, can't . be optimized away like other rows which haven't been . been altered. This is because top cannot predict the . the contents of a search string or, how many matches . might occur in a given row. Short search strings and . many matches would raise buffer needs geometrically. (now that we know a '.' + 2 spaces is squeezed to one) (everything's perfectly justified, but it's just luck) Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
19
top/top.h
19
top/top.h
@ -125,6 +125,9 @@ char *strcasestr(const char *haystack, const char *needle);
|
||||
#define ROWMAXSIZ ( SCREENMAX + 16 * (CAPBUFSIZ + CLRBUFSIZ) )
|
||||
// minimum size guarantee for dynamically acquired 'readfile' buffer
|
||||
#define READMINSZ 2048
|
||||
// size of preallocated search string buffers, same as linein()
|
||||
#define FNDBUFSIZ MEDBUFSIZ
|
||||
|
||||
|
||||
// space between task fields/columns
|
||||
#define COLPADSTR " "
|
||||
@ -370,8 +373,9 @@ typedef struct WIN_t {
|
||||
#else
|
||||
columnhdr [SCREENMAX], // column headings for procflgs
|
||||
#endif
|
||||
*eolcap, // window specific eol termcap
|
||||
*captab [CAPTABMAX]; // captab needed by show_special()
|
||||
char *findstr; // window's current/active search string
|
||||
int findlen; // above's strlen, without call overhead
|
||||
proc_t **ppt; // this window's proc_t ptr array
|
||||
struct WIN_t *next, // next window in window stack
|
||||
*prev; // prior window in window stack
|
||||
@ -464,8 +468,8 @@ typedef struct WIN_t {
|
||||
return Frame_srtflg * strverscmp((*Q)->s, (*P)->s); }
|
||||
|
||||
/*
|
||||
* The following two macros are used to 'inline' those portions of the
|
||||
* display process requiring formatting, while protecting against any
|
||||
* The following three macros are used to 'inline' those portions of the
|
||||
* display process involved in formatting, while protecting against any
|
||||
* potential embedded 'millesecond delay' escape sequences.
|
||||
*/
|
||||
/** PUTT - Put to Tty (used in many places)
|
||||
@ -497,6 +501,14 @@ typedef struct WIN_t {
|
||||
putp(_ptr); } } \
|
||||
} while (0)
|
||||
|
||||
/** POOF - Pulled Out of Frame (used in only 1 place)
|
||||
. for output that is/was sent directly to the terminal
|
||||
but would otherwise have been counted as a Pseudo_row */
|
||||
#define POOF(str,cap) do { \
|
||||
putp(str); putp(cap); \
|
||||
if (Pseudo_row + 1 < Screen_rows) ++Pseudo_row; \
|
||||
} while (0)
|
||||
|
||||
/* Orderly end, with any sort of message - see fmtmk */
|
||||
#define debug_END(s) { \
|
||||
static void error_exit (const char *); \
|
||||
@ -674,6 +686,7 @@ typedef struct WIN_t {
|
||||
//atic void wins_stage_2 (void);
|
||||
/*------ Interactive Input support (do_key helpers) --------------------*/
|
||||
//atic void file_writerc (void);
|
||||
//atic inline int find_ofs (const WIN_t *q, const char *buf);
|
||||
//atic void find_string (int ch);
|
||||
//atic void help_view (void);
|
||||
//atic void keys_global (int ch);
|
||||
|
Reference in New Issue
Block a user