huy.rocks/snarkyterm

snarkyterm: Development Log

Oct 4th, 2021

Started working on a prototype of a terminal emulator, the first part is to get a window opened
and render stuff on its surface. With the help of wgpu and wgpu_glyph, it’s a piece of cake.

The problem is when I started a pty pair, the whole application choke because I tried to read from
ptm right in the event loop. Can’t handle it differently because I don’t have a proper
architecture.

Read more ->

Oct 5th, 2021

Finally I managed to build a better architecture for the app, it’s now have 2 different module
to handle two different stuff: AppFrontend, solely for rendering, and AppBackend to handle
the creation and communication with the ptm….

Read more ->

Oct 6th, 2021

After seeing my screenshot, friend of mine showed me a version of his own terminal emulator
(mos/terminal), I know what you’re
thinking, yes, making a terminal emulator is just a trivial thing that people do these days in
their free time….

Read more ->

Oct 7th, 2021

Not much progress for today, I built a key code to character mapping, so the terminal can now
send proper characters to the ptm. It can handle things like Ctrl + C as well as the tab complete! Yay.

Some keys still not being handled, like the Fn row or the Home/End/PgUp/PgDown keys….

Read more ->

Oct 8th, 2021

Some update to the module names for better understanding and organization…

Read more ->

Oct 10th, 2021

The change today is small but have a huge impact on the performance, I think. And the terminal now able to automatically
scroll to the latest line!

For now, I’m batching the rendering by lines (instead of render char by char), this works for now because there’s no
coloring support. Later on, when we’re able to parse colors, the rendering should be modified to render by tokens, so
texts with the same fg and bg color should be rendered at the same time….

Read more ->

Oct 12th, 2021

Rewrite the algorithm for scrolling the character buffer and calculate the character size before rendering for a more
accurate grid. This also fixed the issue when rendering long lines, some character got overflowed from the current line….

Read more ->

Oct 13th, 2021

Started working on CSI sequence parser, it’s fun to do all this works from scratch, there are too many cases with almost
zero documentation/specs, lol.

According to Wikipedia, I think a CSI sequence can be parsed into a tuple of (param, intermediate, final) bytes like the
following diagram…

Read more ->

Oct 14th, 2021

Today change make use of the Cursor module that we have created a while ago. The character buffer also being changed a bit
to make it easier to get and set characters based on the cursor location.

From now, the screen buffer will be pre-allocated with each W*H blocks. If there are more space needed, a new W*H block
will be allocated. Since the buffer can be huge, we use a variable called START_LINE to determine the render window of the
terminal. Everything in the range of [START_LINE..START_LINE + TERMINAL_ROWS] will be rendered….

Read more ->

Oct 15th, 2021

One step closer to coloring support!

Read more ->