This is an old revision of the document!
The general vt display process begins with the one of vt hardware backends such as vga reading the instance of vt_buf content, then rendering it pixel by pixel onto the screen. However, we don’t want to mess up the terminal content buffer when showing the status bar. To separate the status bar from the data buffer vb_buffer in struct vt_buf, I defined an additional member called vb_ime_buffer in vt_buf for storing the data.
Furthermore, the macro VTBUF_GET_FIELD, which serves as a helper to access the data buffer with the given row and column, also needs to be changed. I extended the macro into a inline function and added a if-else statement to access vb_ime_buffer only when the IME mode is enabled and the hardware is accessing at the row 0 (line 0); otherwise, read the origin buffer. That will show the status bar on the top of screen when the IME mode is enabled and hide it when disabled. The following code snippet shows the diff.
- #define VTBUF_GET_FIELD(vb, r, c) \ + #ifdef VT_IME + inline term_char_t + VTBUF_GET_FIELD(const struct vt_buf *vb, int r, int c) + { + if (vt_ime_buf_state && r == 0) + return vb->vb_ime_buffer[c]; + else + return ((vb)->vb_rows[((vb)->vb_roffset + (r)) % VTBUF_MAX_HEIGHT(vb)][(c)]); + } + #else + #define VTBUF_GET_FIELD(vb, r, c) \ + ((vb)->vb_rows[((vb)->vb_roffset + (r)) % VTBUF_MAX_HEIGHT(vb)][(c)]) + #endif