kh90909 / OakTerm

Serial terminal for the Digistump Oak over the Particle Cloud
8 stars 2 forks source link

Implement user settings functionality #62

Closed emcniece closed 8 years ago

emcniece commented 8 years ago

This commit adds the final user settings functions: Autoscroll, Line endings, Submit-on-enter, and visible scroll bars.

Other major changes:

emcniece commented 8 years ago

@kh90909 test, suggest and merge at will!

kh90909 commented 8 years ago

I ran into a few issues with this...

Can we remove the horizontal scroll bar? The spec says everything in the terminal should wrap, so I don't think it's necessary. Also, I think the scroll bar on the sidebar should show only if the content doesn't fit on the screen. Is it possible to change the scroll bar colors or is it system controlled? The light grey bar messes with the dark color scheme!

Also, maybe it would be better to move the 'Visible Scroll Bars' row in the modal up above the Show/Hide section. Since the toggle is the same size as the one for "Submit on Enter", I think it will fit in better there.

emcniece commented 8 years ago

Did some research.

  1. Visible Scrollbar setting - _.extend() is creating a duplicate setting during get_settings(), which is then double-processed when the button toggle labels are updated during restore_settings(). This behavior is due to the settings being an array instead of an object, so save_settings() will need to serializeArray into an object (easy transform). The surrounding settings handlers will need to be updated to work with an object as well.
  2. Page bottom detection is done in terminal_print() by comparing window height, scroll position, and document height. The jitter problem happens when the user tries to scroll while the jQuery scrollTop animation is still executing, and the current scroll "greed" is set to 50px which seems to not be enough to use a single scrollbar click to escape. The jitter fix is to reduce the animation time (from 1000ms to 250ms), and the greed can be reduced safely to 30px.
  3. No fix for line end escaping yet - need to test.

Other issues:

emcniece commented 8 years ago

Ready for demo: https://rawgit.com/emcniece/OakTerm/feat/i23-user-settings/index.html

Be sure to clear localStorage before testing!

kh90909 commented 8 years ago

Hope you don't mind. I was working through the error handling and came across the line end escaping code and fixed it. I haven't had a chance to test the other updates yet. Once I do I'll merge it along with the escaping fix. Hopefully tomorrow.