Skip to content

core: fix divide by zero when terminal reports zero width#6677

Open
dylantirandaz wants to merge 1 commit intosimplex-chat:masterfrom
dylantirandaz:fix/terminal-zero-width-divide-by-zero
Open

core: fix divide by zero when terminal reports zero width#6677
dylantirandaz wants to merge 1 commit intosimplex-chat:masterfrom
dylantirandaz:fix/terminal-zero-width-divide-by-zero

Conversation

@dylantirandaz
Copy link
Copy Markdown

Summary

  • Clamp terminal dimensions to a minimum of 1 in newChatTerminal to prevent divide by zero in environments that report zero-sized terminals (e.g. emacs eshell)
  • Fixes all three division sites in Output.hs (inputHeight, positionRowColumn, lineCount) and the broken arrow key arithmetic in Input.hs

Fixes #5548

Test plan

  • Run CLI inside emacs eshell — should no longer crash with "divide by zero"
  • Run CLI in a normal terminal — no change in behavior

Clamp terminal dimensions to a minimum of 1 to prevent
divide by zero in environments that report zero-sized
terminals (e.g. emacs eshell).

Fixes simplex-chat#5548
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 13, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@dylantirandaz
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@dylantirandaz
Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant