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

How to add scrollbar? #45

Open
mustafaakin opened this issue Sep 3, 2014 · 12 comments
Open

How to add scrollbar? #45

mustafaakin opened this issue Sep 3, 2014 · 12 comments

Comments

@mustafaakin
Copy link

How can I add a scroll bar? Currently when I scroll it with mouse wheel it is okay, but I think it changes the dom to do so by having the exact number of divs as height, and modifying its content on mousewheel.

There is Terminal.prototype.bindMouse = function() { , by looking its context all I see it sends some characters but I am not sure. Any thoughts on this? I can at least bind two buttons, one up and down for emulating that mouse movement one by one.

@andyliuliming
Copy link

the scroll can be done by ctrl+arrow up arrow down, or just use your middle scroll mouse to scroll.
BTW, in IE the mouse scroll is not working.

@jakirkham
Copy link

Also, would really love to see a scrollbar. Is this feasible?

@jakirkham
Copy link

Part of why a scrollbar would be nice is scrolling in other ways is really sensitive. So, I will skip past the interesting section. Plus, the other reasons scrollbars are nice.

@soichih
Copy link

soichih commented Sep 19, 2015

+1

I can probably implement the scrollbar feature (using this.ydisp & this.ybase as scroll bar position / height etc..?) but the author of this project doesn't seem to be accepting pull-request.. Maybe I should work on jeremyramin/term.js branch instead?

@aurium
Copy link

aurium commented Sep 28, 2015

I did it using jQueryUI.

  <div id="terminal-outbox">
    <div class="terminal-container">Loading Terminal...</div>
  </div>
  <div id="scroller"></div>

The CSS put the #scroller absolute placed at right:0, top:0 and bottom:0

...
        var div = $('.terminal-container').empty()[0];
        term.open(div);

        var scroller = $('#scroller').slider({
          orientation: 'vertical',
          value: -term.ydisp,
          min: -term.ybase,
          max: 0,
          step: 1,
          slide: function(event, ui) {
            console.log(term.ybase, ui.value, term.ydisp);
            term.scrollDisp(-ui.value - term.ydisp);
          }
        });

        function updateScroller() {
          scroller.slider('option', 'min', -term.ybase);
          scroller.slider('option', 'value', -term.ydisp);
        }

...
        socket.on('data', function(data) {
          if (data.termData != null) {
            term.write(data.termData);
            updateTitle();
            updateScroller();
          }
        });
...

Simple as piece of cake. :-)

@soichih
Copy link

soichih commented Oct 9, 2015

Is there a way to do something similar using just the native browser scrollbar? Maybe by overlaying another transparent div on top of the term window?

@aurium
Copy link

aurium commented Oct 9, 2015

Sure @soichih! I like the themeable jQuery scroll, but i would like to see a native scrollbar approach.

@briceburg
Copy link

I believe this is implemented in the butterfly project -- https://github.com/paradoxxxzero/butterfly/blob/master/coffees/term.coffee

@jakirkham
Copy link

I think some of the users of this project appreciate the permissive licensing of this project. So, it is doubtful they will want to switch to a GPL'd project.

@soichih
Copy link

soichih commented Jun 18, 2016

Did anyone manage to implement HTML5 only scrollbar for this? I can't think of a way to display just the scrollbar without creating a narrow div (with scroll: auto) next to the term.

@mei-rune
Copy link

This project is no longer maintained ⚠️. For a maintained fork take a look at https://github.com/sourcelair/xterm.js

@soichih
Copy link

soichih commented Jun 18, 2016

I tried to switch to xterm.js, but it doesn't seem to support terminal colors. All text is displayed in black & white. Also, xterm.js doesn't seem to support scrollbar..

xterm.js does support colors. I just had to add TERM=xterm-256color to the ENV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants