diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2011-09-25 23:51:12 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2011-09-25 23:51:12 +0000 |
| commit | 6ff06ca98523f7aff016cbc8d00b9faa756739db (patch) | |
| tree | 08ea37f839a2b89e7e03d7f651b9e7fee5f963a7 /src/main.cc | |
| parent | 639897517a2fabc78d274fb17fe57c21e951bf83 (diff) | |
DisplayBuffer: cleanup
Diffstat (limited to 'src/main.cc')
| -rw-r--r-- | src/main.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main.cc b/src/main.cc index dd955acc..e971b066 100644 --- a/src/main.cc +++ b/src/main.cc @@ -14,6 +14,14 @@ using namespace Kakoune; using namespace std::placeholders; +void set_attribute(int attribute, bool on) +{ + if (on) + attron(attribute); + else + attroff(attribute); +} + void draw_window(Window& window) { int max_x,max_y; @@ -23,16 +31,15 @@ void draw_window(Window& window) window.set_dimensions(WindowCoord(max_y, max_x)); window.update_display_buffer(); - WindowCoord position; for (const DisplayAtom& atom : window.display_buffer()) { const std::string& content = atom.content; - if (atom.attribute & UNDERLINE) - attron(A_UNDERLINE); - else - attroff(A_UNDERLINE); + set_attribute(A_UNDERLINE, atom.attribute & Underline); + set_attribute(A_REVERSE, atom.attribute & Reverse); + set_attribute(A_BLINK, atom.attribute & Blink); + set_attribute(A_BOLD, atom.attribute & Bold); size_t pos = 0; size_t end; |
