fix(output): print tab and line-break titles on one line in listings - #318
Merged
Merged
Conversation
A title, tag, project, area or group header holding a line break split its listing row in two, and one holding a tab, which measures as no columns but lipgloss pads out to four, wrapped onto a second line. Each line break (\r\n, \r or \n) and tab in that text now prints as a space, on a terminal and piped, before any styling. The detail block and --json keep the text as written. The cut wide-rune title needs no change: half a wide rune cannot print, so a cut can stop a cell short, and the column padding fills it; the next column lines up. A golden case with two cut CJK rows and their dates now pins that. The docs said piped output keeps tags and dates whole; a row over 120 columns still drops whole columns, and commands.md now says so. agents.md said piped output loses its column alignment, which it does not.
… line From review: oneLine also turns a vertical tab, form feed, NEL and the Unicode line and paragraph separators into a space, since lipgloss and terminals break lines on them too. The candidates listed for an ambiguous task reference go through the same helper. The docs now say a column over 120 goes from every piped row, not only the wide one, and that show keeps a title's own line breaks rather than every byte.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A task title, tag, project, area or group header that holds a line break used to split its listing row in two. One that holds a tab wrapped onto a second line, because a tab measures as no columns but lipgloss pads it out to four. This is the last step of the internal/output consolidation (#314, #316, #317).
Change
oneLinehelper turns each line break into a space:\r\n,\r,\n, vertical tab, form feed, NEL, and the Unicode line and paragraph separators. It does the same for each tab. It runs on the raw text before styling, because lipgloss pads a multi-line styled string to its widest line and expands tabs.--json, the detail block and the agent brief are unchanged.things showkeeps a title's own line breaks, andhangindents them under the value.Golden file changes
print/tasks-KNOWN-BUG-tab-newline-titlescases (2 widths × 2 colours) are renamed toprint/tasks-tab-newline-titlesand now show one line per task.print/tasks-more-control-chars@40and@piped: CR and CRLF, a dim title with a newline, a tag with a tab, and a header with a newline.print/collections-control-chars@piped: projects, areas and tags.print/tasks-wide-runes-dated@60and@40.Checks
thingsfrom main (fcf2779) and from this branch and compared them on an unedited copy of a Things backup, which has no control characters, withHOMEpointed at a temporary directory. 19 commands, includingshow --agent, ran piped and in a pseudo-terminal at 40, 62, 80, 100, 120 and 200 columns, with colour off and on. All 266 pairs were byte-identical. A run of main against itself also gave 0 differences.--jsonkeeps the raw titles.due:in the same column at 60. At 40 and 50 the date column is dropped, as before.TestOneLine, andTestResolveTaskAmbiguousTitleOnOneLinein cmd.make testandmake lintpass.Not changed