{"record":{"id":"0a4b1b4bfd501ae7","repo":"Textualize/textual","slug":"hatch-character-must-have-a-cell-length-of-1","errorCode":null,"errorMessage":"Hatch character must have a cell length of 1","messagePattern":"Hatch character must have a cell length of 1","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/textual/css/_style_properties.py","lineNumber":1253,"sourceCode":"        _rich_traceback_omit = True\n        if value is None:\n            if obj.clear_rule(\"hatch\"):\n                obj.refresh(children=True)\n            return\n\n        if value == \"none\":\n            hatch = \"none\"\n        else:\n            character, color = value\n            if len(character) != 1:\n                try:\n                    character = HATCHES[character]\n                except KeyError:\n                    raise ValueError(\n                        f\"Expected a character or hatch value here; found {character!r}\"\n                    ) from None\n            if cell_len(character) != 1:\n                raise ValueError(\"Hatch character must have a cell length of 1\")\n            if isinstance(color, str):\n                color = Color.parse(color)\n            hatch = (character, color)\n\n        obj.set_rule(\"hatch\", hatch)\n","sourceCodeStart":1235,"sourceCodeEnd":1259,"githubUrl":"https://github.com/Textualize/textual/blob/06dbeef4bb70fb718236aa418ed658ef4667a126/src/textual/css/_style_properties.py#L1235-L1259","documentation":"After resolving a hatch character (possibly via HATCHES), Textual verifies its terminal cell width is exactly 1 using cell_len. Zero-width or double-width characters (combining marks, CJK, emoji) raise this ValueError even if the input is a single Python character.","triggerScenarios":"`styles.hatch = (\"中\", \"red\")` (double-width), a combining character like '\\u0301', or a zero-width space — each is one char but cell_len != 1.","commonSituations":"Using non-ASCII characters from international keyboards or emoji as hatch fills without considering terminal cell width.","solutions":["Stick to ASCII characters with cell width 1 (e.g. '-', '/', '|', '.')","Use named HATCHES values which are pre-validated"],"exampleFix":"# before\nstyles.hatch = (\"中\", \"red\")\n# after\nstyles.hatch = (\"/\", \"red\")","handlingStrategy":"validation","validationCode":"from rich.cells import cell_len\nif cell_len(ch) == 1:\n    styles.hatch = (ch, color)","typeGuard":"def is_cell_width_one(ch: str) -> bool:\n    from rich.cells import cell_len\n    return cell_len(ch) == 1","tryCatchPattern":null,"preventionTips":["Prefer ASCII hatch characters or named HATCHES values"],"tags":["textual","css","hatch","unicode-width"],"backgroundTag":"invalid-css-value","analyzedSha":"06dbeef4bb70fb718236aa418ed658ef4667a126","analyzedAt":"2026-08-27T02:36:57.214Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}