From 5ed31309b6d0db94ccd566914653d367f4577c64 Mon Sep 17 00:00:00 2001 From: historia Date: Fri, 28 Aug 2026 04:45:29 -0400 Subject: fix: japanese characters not truncated correctly in tui terminal output --- app/tests/test_taskview.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app/tests/test_taskview.py') diff --git a/app/tests/test_taskview.py b/app/tests/test_taskview.py index 1db708d..78cc2f1 100644 --- a/app/tests/test_taskview.py +++ b/app/tests/test_taskview.py @@ -725,6 +725,25 @@ class LanesViewTests(_FakeTui, unittest.TestCase): pane_w = (screen.width - 3) // 2 self.assertLessEqual(x + len(label) - 1, 1 + pane_w - 2) + def test_split_render_truncates_wide_log_lines_to_their_pane(self): + # Regression: Japanese characters fill two terminal cells each, + # so fitting by character count let transcription results spill + # out of the right pane onto the left one. + view, screen = self.make_view(self._two_lanes(), width=80) + view._ingest_lane_line(view._lanes[1], + "[OK] 一号: " + "語" * 40) + view.render() + found = [(x, t) for _, x, t, _ in screen.strings + if t.startswith("[OK] ")] + self.assertEqual(len(found), 1) + x, line = found[0] + self.assertTrue(line.endswith("~")) + pane_w = (screen.width - 3) // 2 + px, pw = 1 + pane_w + 1, (screen.width - 3) - pane_w + self.assertGreaterEqual(x, px + 1) + self.assertLessEqual(x + taskview.tui._disp_width(line) - 1, + px + pw - 2) + class SilenceCueTests(_FakeTui, unittest.TestCase): """The "(no output 6m)" cue for a running step that stopped emitting.""" -- cgit v1.2.3