TTabCairn
Workflows

Coding workflows · Logical tab-stop columns

03
Built around your work

A concrete starting point

Count single-line logical columns using fixed tab stops and one column per other Unicode code point. Check consecutive tabs and an emoji, rejecting zero-width stops and line breaks rather than reporting terminal display width.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Logical tab-stop columns

A concrete starting point
def logical_column(text, tab_width):
    if not isinstance(text, str):
        raise ValueError("text.required")
    if type(tab_width) is not int or tab_width <= 0:
        raise ValueError("tab.width")
    if "\r" in text or "\n" in text:
        raise ValueError("line.break")
    column = 0
    for char in text:
        column += tab_width - column % tab_width if char == "\t" else 1
    return column

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗