Skip to content

TUI transcript rewrites ordered-list numbers #5013

@thomaspeklak

Description

@thomaspeklak

What happened?

If I type:

  4. forth                                                                                                                                                                                                                                                        
  3. third                                                                                                                                                                                                                                                        

the input editor shows it correctly before submit, but after submit the rendered user message displays:

  4. forth                                                                                                                                                                                                                                                        
  5. third                                                                                                                                                                                                                                                        

Screenshot-Proof:
Image


The clanker thinks this is the problem:

Likely cause

In v0.75.5, UserMessageComponent renders user prompts through Markdown:

  • src/modes/interactive/components/user-message.ts

The shared Markdown renderer then computes ordered-list bullets using the list start plus the item index:

  • @earendil-works/pi-tui/src/components/markdown.ts
  • renderList()
  • const bullet = token.ordered ? ${startNumber + i}. : "- ";

That discards the original marker from item.raw, where marked still has the typed marker.

Steps to reproduce

Write

   4. forth                                                                                                                                                                                                                                                        
   3. third                                                                                                                                                                                                                                                        

Expected behavior

Tui should print out the same

   4. forth                                                                                                                                                                                                                                                        
   3. third                                                                                                                                                                                                                                                        

Version

0.75.5

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinginprogressIssue is being worked on

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions