diff options
| author | historia <historiavg@proton.me> | 2026-08-28 04:45:29 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-28 04:45:29 -0400 |
| commit | 5ed31309b6d0db94ccd566914653d367f4577c64 (patch) | |
| tree | b909445125629181eb8aa38e4805f672bdaf9c20 /app/tests/test_taskview.py | |
| parent | 0dda9a5921eafd03853d233e077138ff72d64e4d (diff) | |
| download | tts-audiobook-generator-5ed31309b6d0db94ccd566914653d367f4577c64.tar.gz | |
fix: japanese characters not truncated correctly in tui terminal output
Diffstat (limited to 'app/tests/test_taskview.py')
| -rw-r--r-- | app/tests/test_taskview.py | 19 |
1 files changed, 19 insertions, 0 deletions
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.""" |
