Skip to content

Repository files navigation

Terminal Buffer

This is my implementation of a terminal buffer in the context of Jetbrain internship applications.

Decisions, tradeoffs and future improvements

One important decision was how to represent the scrollable buffer. I decided to make it as a queue, since that makes it easy to enqueue lines that must disappear from the screen, and dequeue the ones that are too far to be in the scrollable buffer anymore. If we made it as an array, a lot of shifting would need to happen

A future improvement I would have done if I had more time would be to define further empty line on the screen behaviour, for example by having a variable storing where is the last non-empty line on the screen. This would allow for clearer behaviour when a line is added or removed, what needs to happen on the screen (for example, if we know there is more empty screen on the terminal, we can push everything in the screen array, instead of pushing back into the scrollable buffer).

Another noteworthy decision was the implementation of resize, which uses the function to get the content of the screen and scrollable buffer as a string, and then clears the entire screen and scrollable buffer and rewrites everything using the insertTextAtPosition function (which handles wrapping) by splitting on '\n', which says when a new line happens. This is the easiest implementation of this feature I could think of, and in truth, it does not handle keeping track of the colors and style flags of the pixels. This would be another possible future improvement

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages