Skip to content

Commit 4dc1b3d

Browse files
committed
Fix frame drawing regressions.
1 parent b5081ef commit 4dc1b3d

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Added
2020

2121
Fixed
2222
- Contexts now give a more useful error when pickled.
23+
- Fixed regressions with `tcod.console_print_frame` and `Console.print_frame`
24+
when given empty strings as the banner.
2325

2426
12.2.0 - 2021-04-09
2527
-------------------

tcod/console.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import tcod._internal
1414
import tcod.constants
15-
from tcod._internal import deprecate
15+
from tcod._internal import _check, deprecate
1616
from tcod.loader import ffi, lib
1717

1818

@@ -35,6 +35,7 @@ def _fmt(string: str) -> bytes:
3535
.. versionadded:: 12.3
3636
"""
3737

38+
3839
class Console:
3940
"""A console object containing a grid of characters with
4041
foreground/background colors.
@@ -723,8 +724,10 @@ def print_frame(
723724
"""
724725
self.__deprecate_defaults("draw_frame", bg_blend)
725726
string = _fmt(string) if string else ffi.NULL
726-
lib.TCOD_console_printf_frame(
727-
self.console_c, x, y, width, height, clear, bg_blend, string
727+
_check(
728+
lib.TCOD_console_printf_frame(
729+
self.console_c, x, y, width, height, clear, bg_blend, string
730+
)
728731
)
729732

730733
def blit(

tcod/libtcodpy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,11 @@ def console_print_frame(
16851685
Use :any:`Console.print_frame` instead.
16861686
"""
16871687
fmt = _fmt(fmt) if fmt else ffi.NULL
1688-
lib.TCOD_console_printf_frame(_console(con), x, y, w, h, clear, flag, fmt)
1688+
_check(
1689+
lib.TCOD_console_printf_frame(
1690+
_console(con), x, y, w, h, clear, flag, fmt
1691+
)
1692+
)
16891693

16901694

16911695
@pending_deprecate()

0 commit comments

Comments
 (0)