Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes leahneukirchen/mblaze#194 #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions man/mblaze-profile.5
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ will be used as a default.
.It Li Scan\&-Format\&:
The default format string for
.Xr mscan 1 .
.It Li Scan\&-Lines\&:
The number of lines to scan when using
.Xr mless 1 .
.It Li Sendmail\&:
The program that
.Xr mcom 1
Expand Down
3 changes: 3 additions & 0 deletions man/mless.1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Additional keybindings loaded for convenience.
.It Pa ${MBLAZE:-$HOME/.mblaze}/mless , Pa $HOME/.mless
Additional compiled keybindings loaded for convenience.
(Only needed for less earlier than version 590.)
.It Pa ${MBLAZE:-$HOME/.mblaze}/profile
Number of lines/messages to scan which are shown on top.
If not set, 6 lines are used as the default.
.El
.Sh EXIT STATUS
.Ex -std
Expand Down
14 changes: 8 additions & 6 deletions mless
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ if [ "$1" = --filter ]; then
mseq -C "$2"

total=$(mscan -n -- -1)
linesToScan=$(mhdr -h Scan-Lines "$MBLAZE/profile")
linesToScan=${linesToScan:-6}
case $2 in
1) mscan .-0:.+5 ;;
2) mscan .-1:.+4 ;;
$((total - 2))) mscan .-3:.+2 ;;
$((total - 1))) mscan .-4:.+1 ;;
$total) mscan .-5:.+0 ;;
*) mscan .-2:.+3 ;;
1) mscan .-0:.+$(expr $linesToScan - 1) ;;
2) mscan .-1:.+$(expr $linesToScan - 2) ;;
$((total - 2))) mscan .-3:.+$(expr $linesToScan - 4) ;;
$((total - 1))) mscan .-4:.+$(expr $linesToScan - 5) ;;
$total) mscan .-5:.+$(expr $linesToScan - 6) ;;
*) mscan .-2:.+$(expr $linesToScan - 3) ;;
esac 2>/dev/null | colorscan
echo

Expand Down