diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-01-15 07:39:51 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-01-15 07:39:51 +0100 |
commit | d14ec951eaaa252fcfe69438be42eae009833d88 (patch) | |
tree | 0c5a25be1774710132264b99686b4875e02b711e | |
parent | c24f543a57f8f9f8c734f123f1de5e9268e8c938 (diff) | |
download | serenity-d14ec951eaaa252fcfe69438be42eae009833d88.zip |
Terminal: Add some inset and line spacing.
This is starting to feel vaguely usable! :^)
-rw-r--r-- | Terminal/Terminal.cpp | 9 | ||||
-rw-r--r-- | Terminal/Terminal.h | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/Terminal/Terminal.cpp b/Terminal/Terminal.cpp index 94dacc2f1e..dd8a708db3 100644 --- a/Terminal/Terminal.cpp +++ b/Terminal/Terminal.cpp @@ -10,8 +10,8 @@ void Terminal::create_window() { auto& font = Font::defaultFont(); - m_pixel_width = m_columns * font.glyphWidth(); - m_pixel_height = m_rows * font.glyphHeight(); + m_pixel_width = m_columns * font.glyphWidth() + m_inset * 2; + m_pixel_height = (m_rows * (font.glyphHeight() + m_line_spacing)) + (m_inset * 2); GUI_CreateWindowParameters params; params.rect = { { 300, 300 }, { m_pixel_width, m_pixel_height } }; @@ -161,7 +161,6 @@ void Terminal::escape$m(const Vector<unsigned>& params) case 36: case 37: // Foreground color - dbgprintf("foreground = %d\n", param - 30); m_current_attribute.foreground_color = param - 30; break; case 40: @@ -393,12 +392,12 @@ void Terminal::paint() Painter painter(*m_backing); for (word row = 0; row < m_rows; ++row) { - int y = row * font.glyphHeight(); + int y = row * (font.glyphHeight() + m_line_spacing); for (word column = 0; column < m_columns; ++column) { char ch = m_buffer[(row * m_columns) + (column)]; auto& attribute = m_attributes[(row * m_columns) + (column)]; int x = column * font.glyphWidth(); - Rect glyph_rect { x + 2, y + 2, font.glyphWidth(), font.glyphHeight() }; + Rect glyph_rect { x + m_inset, y + m_inset, font.glyphWidth(), font.glyphHeight() + m_line_spacing}; auto glyph_background = ansi_color(attribute.background_color); painter.fill_rect(glyph_rect, glyph_background); if (ch == ' ') diff --git a/Terminal/Terminal.h b/Terminal/Terminal.h index 6d362351d4..debbb1f19a 100644 --- a/Terminal/Terminal.h +++ b/Terminal/Terminal.h @@ -80,4 +80,7 @@ private: int m_pixel_width { 0 }; int m_pixel_height { 0 }; + + int m_inset { 2 }; + int m_line_spacing { 4 }; }; |