top: enable recall of previous input lines for re-edit

With this commit, users can now retrieve previous line
input for re-editing and/or re-input using the Up/Down
arrow keys (or their aliases). This mirrors the 'bash'
or 'less' interface and represents a major enhancement
achieved via a somewhat minor impact to our code base.

[ 33 lines of code, 5 closing braces & some comments ]
[ all in 1 function, when TERMIOS_ONLY isn't defined ]

Currently, the upper limit for such recallable strings
has been set at 50 but that could be easily increased.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2013-02-15 00:00:00 -06:00
committed by Craig Small
parent 477b10c0bd
commit 2efe275512
3 changed files with 75 additions and 12 deletions

View File

@@ -90,7 +90,7 @@
.
.\" Document /////////////////////////////////////////////////////////////
.\" ----------------------------------------------------------------------
.TH TOP 1 "January 2013" "procps-ng" "User Commands"
.TH TOP 1 "February 2013" "procps-ng" "User Commands"
.\" ----------------------------------------------------------------------
.\" ----------------------------------------------------------------------
@@ -208,6 +208,15 @@ Insert this command after \*(We has been suspended but before resuming it.
reset restore your \fBterminal settings\fR
.Ed
\*(NT the width of \*(We's display will be limited to \*(WX positions.
Displaying all fields requires \*(WF characters.
Remaining screen width is usually allocated to any variable width columns
currently visible.
The variable width columns, such as COMMAND, are noted in topic
3a. DESCRIPTIONS of Fields.
Actual output width may also be influenced by the \-w switch, which is
discussed in topic 1. COMMAND\-LINE Options.
Lastly, some of \*(We's screens or functions require the use of cursor
motion keys like the standard \*(KAs plus the Home, End, PgUp and PgDn keys.
If your terminal or emulator does not provide those keys, the following
@@ -224,14 +233,20 @@ combinations are accepted as alternatives:
End alt +\fB Right\fR or alt + ctrl +\fB l \fR
.Ed
\*(NT the width of \*(We's display will be limited to \*(WX positions.
Displaying all fields requires \*(WF characters.
Remaining screen width is usually allocated to any variable width columns
currently visible.
The variable width columns, such as COMMAND, are noted in topic
3a. DESCRIPTIONS of Fields.
Actual output width may also be influenced by the \-w switch, which is
discussed in topic 1. COMMAND\-LINE Options.
The \fBUp\fR and \fBDown\fR \*(KAs have special significance when prompted
for line input terminated with the <Enter> key.
Those keys, or their aliases, can be used to retrieve previous input lines
which can then be edited and re-input.
And there are four additional keys available with line oriented input.
.Bd -literal -compact
\fI key special-significance \fR
Up recall \fBolder\fR strings for re-editing
Down recall \fBnewer\fR strings or \fBerase\fR entire line
Insert toggle between \fBinsert\fR and \fBovertype\fR modes
Delete character \fBremoved\fR at cursor, moving others left
Home jump to \fBbeginning\fR of input line
End jump to \fBend\fR of input line
.Ed
.\" ......................................................................
.SS Startup Defaults