Start scrolling command prompt when filled until a particular fraction

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
2












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%)?







share|improve this question


























    up vote
    2
    down vote

    favorite
    2












    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%)?







    share|improve this question
























      up vote
      2
      down vote

      favorite
      2









      up vote
      2
      down vote

      favorite
      2






      2





      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%)?







      share|improve this question














      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%)?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 21 '14 at 3:07

























      asked Feb 21 '14 at 3:01









      user13107

      2,20982652




      2,20982652




















          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






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            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






























            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






            share|improve this answer
























              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






              share|improve this answer






















                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






                share|improve this answer












                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







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 22 '14 at 15:12









                X Tian

                7,29111836




                7,29111836






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    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













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay