Start scrolling command prompt when filled until a particular fraction

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm using the default terminal command prompt on Ubuntu 12.04. When I'm doing something on the prompt (as opposed to editing in VI) the scrolling starts when the text reaches bottom of the screen. I don't like that because I have to keep my eyes always at the bottom of the screen. I would prefer if there were an option to start scrolling things up when we reach a particular fraction of vertical screen size. Currently I just use clear screen (CTRL+L) but it's tedious to do that every time. I don't like resizing command prompt because the background distracts me and I have to resize it each time in a new session. Is there some way to do scroll when prompt fills until a particular fraction (say 70%)?
command-line terminal
add a comment |Â
up vote
2
down vote
favorite
I'm using the default terminal command prompt on Ubuntu 12.04. When I'm doing something on the prompt (as opposed to editing in VI) the scrolling starts when the text reaches bottom of the screen. I don't like that because I have to keep my eyes always at the bottom of the screen. I would prefer if there were an option to start scrolling things up when we reach a particular fraction of vertical screen size. Currently I just use clear screen (CTRL+L) but it's tedious to do that every time. I don't like resizing command prompt because the background distracts me and I have to resize it each time in a new session. Is there some way to do scroll when prompt fills until a particular fraction (say 70%)?
command-line terminal
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm using the default terminal command prompt on Ubuntu 12.04. When I'm doing something on the prompt (as opposed to editing in VI) the scrolling starts when the text reaches bottom of the screen. I don't like that because I have to keep my eyes always at the bottom of the screen. I would prefer if there were an option to start scrolling things up when we reach a particular fraction of vertical screen size. Currently I just use clear screen (CTRL+L) but it's tedious to do that every time. I don't like resizing command prompt because the background distracts me and I have to resize it each time in a new session. Is there some way to do scroll when prompt fills until a particular fraction (say 70%)?
command-line terminal
I'm using the default terminal command prompt on Ubuntu 12.04. When I'm doing something on the prompt (as opposed to editing in VI) the scrolling starts when the text reaches bottom of the screen. I don't like that because I have to keep my eyes always at the bottom of the screen. I would prefer if there were an option to start scrolling things up when we reach a particular fraction of vertical screen size. Currently I just use clear screen (CTRL+L) but it's tedious to do that every time. I don't like resizing command prompt because the background distracts me and I have to resize it each time in a new session. Is there some way to do scroll when prompt fills until a particular fraction (say 70%)?
command-line terminal
edited Feb 21 '14 at 3:07
asked Feb 21 '14 at 3:01
user13107
2,20982652
2,20982652
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
I'm using gnome-terminal as my console and it respects the vt100 set scroll region Control character Sequence.
$ cat setscroll.sh
function min()
if [[ $1 -le $2 ]]; then echo $1; else echo $2; fi
function max()
if [[ $1 -ge $2 ]]; then echo $1; else echo $2; fi
function setscrollregion()
CLR="33[2J"
SRGN="33[1;"$1"r"
echo -ne $CLR$SRGN
function calcline()
set `stty size` $1 # ;echo height=$1 width=$2 perc=$3
bline=$(( ($1 * $3 ) / 100 )) # calculate bottom line
bline=$( min $bline $1) # max is screen height
bline=$( max 5 $bline) # min is 5 lines customise as you wish
echo $bline
setscrollregion $(calcline $1)
Then,
$ bash ./setscroll.sh 50
will set the scroll region to 50% of height
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
I'm using gnome-terminal as my console and it respects the vt100 set scroll region Control character Sequence.
$ cat setscroll.sh
function min()
if [[ $1 -le $2 ]]; then echo $1; else echo $2; fi
function max()
if [[ $1 -ge $2 ]]; then echo $1; else echo $2; fi
function setscrollregion()
CLR="33[2J"
SRGN="33[1;"$1"r"
echo -ne $CLR$SRGN
function calcline()
set `stty size` $1 # ;echo height=$1 width=$2 perc=$3
bline=$(( ($1 * $3 ) / 100 )) # calculate bottom line
bline=$( min $bline $1) # max is screen height
bline=$( max 5 $bline) # min is 5 lines customise as you wish
echo $bline
setscrollregion $(calcline $1)
Then,
$ bash ./setscroll.sh 50
will set the scroll region to 50% of height
add a comment |Â
up vote
4
down vote
accepted
I'm using gnome-terminal as my console and it respects the vt100 set scroll region Control character Sequence.
$ cat setscroll.sh
function min()
if [[ $1 -le $2 ]]; then echo $1; else echo $2; fi
function max()
if [[ $1 -ge $2 ]]; then echo $1; else echo $2; fi
function setscrollregion()
CLR="33[2J"
SRGN="33[1;"$1"r"
echo -ne $CLR$SRGN
function calcline()
set `stty size` $1 # ;echo height=$1 width=$2 perc=$3
bline=$(( ($1 * $3 ) / 100 )) # calculate bottom line
bline=$( min $bline $1) # max is screen height
bline=$( max 5 $bline) # min is 5 lines customise as you wish
echo $bline
setscrollregion $(calcline $1)
Then,
$ bash ./setscroll.sh 50
will set the scroll region to 50% of height
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
I'm using gnome-terminal as my console and it respects the vt100 set scroll region Control character Sequence.
$ cat setscroll.sh
function min()
if [[ $1 -le $2 ]]; then echo $1; else echo $2; fi
function max()
if [[ $1 -ge $2 ]]; then echo $1; else echo $2; fi
function setscrollregion()
CLR="33[2J"
SRGN="33[1;"$1"r"
echo -ne $CLR$SRGN
function calcline()
set `stty size` $1 # ;echo height=$1 width=$2 perc=$3
bline=$(( ($1 * $3 ) / 100 )) # calculate bottom line
bline=$( min $bline $1) # max is screen height
bline=$( max 5 $bline) # min is 5 lines customise as you wish
echo $bline
setscrollregion $(calcline $1)
Then,
$ bash ./setscroll.sh 50
will set the scroll region to 50% of height
I'm using gnome-terminal as my console and it respects the vt100 set scroll region Control character Sequence.
$ cat setscroll.sh
function min()
if [[ $1 -le $2 ]]; then echo $1; else echo $2; fi
function max()
if [[ $1 -ge $2 ]]; then echo $1; else echo $2; fi
function setscrollregion()
CLR="33[2J"
SRGN="33[1;"$1"r"
echo -ne $CLR$SRGN
function calcline()
set `stty size` $1 # ;echo height=$1 width=$2 perc=$3
bline=$(( ($1 * $3 ) / 100 )) # calculate bottom line
bline=$( min $bline $1) # max is screen height
bline=$( max 5 $bline) # min is 5 lines customise as you wish
echo $bline
setscrollregion $(calcline $1)
Then,
$ bash ./setscroll.sh 50
will set the scroll region to 50% of height
answered Feb 22 '14 at 15:12
X Tian
7,29111836
7,29111836
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f116216%2fstart-scrolling-command-prompt-when-filled-until-a-particular-fraction%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password