groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 10/14: [grotty]: Add assertion to line-drawing code.


From: G. Branden Robinson
Subject: [groff] 10/14: [grotty]: Add assertion to line-drawing code.
Date: Fri, 29 Dec 2023 21:07:19 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 6d46720dbd68612ec40cffc09016bf42d2ed3992
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Dec 29 19:03:00 2023 -0600

    [grotty]: Add assertion to line-drawing code.
    
    * src/devices/grotty/tty.cpp (tty_printer::end_page): Add `assert()` to
      check invariant.
    
    Also fix code style nit (overlong line).
---
 ChangeLog                  | 5 +++++
 src/devices/grotty/tty.cpp | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index a5e82b9bb..0f8de1caf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2023-12-29  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grotty/tty.cpp (tty_printer::end_page): Add
+       `assert()` to check invariant.
+
 2023-12-29  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/tbl/tests/check-horizontal-line-length.sh: Tweak
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 1b92ad8c0..070ee2e30 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -779,6 +779,9 @@ void tty_printer::end_page(int page_length)
        continue;
       }
       if (nextp && p->hpos == nextp->hpos) {
+       // We expect HDRAW_MODE glyphs to always precede VDRAW_MODEs.
+       assert (!(p->draw_mode() == VDRAW_MODE
+                 && nextp->draw_mode() == HDRAW_MODE));
        if (p->draw_mode() == HDRAW_MODE &&
            nextp->draw_mode() == VDRAW_MODE) {
          if (font::is_unicode)
@@ -789,7 +792,8 @@ void tty_printer::end_page(int page_length)
            nextp->code = '+';
          continue;
        }
-       if (p->draw_mode() != 0 && p->draw_mode() == nextp->draw_mode()) {
+       if (p->draw_mode() != 0 && p->draw_mode() == nextp->draw_mode())
+       {
          nextp->code = p->code;
          continue;
        }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]