racket / racket/gui

CRLF and LF characters inside a message% add unwanted extra lines in Windows

Open
#272 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
68
Forks
82
PR merge metrics
No merged PRs in 30d

Description

When creating a multi-line message% in a racket/gui app and running the app on an Ubuntu system, things display correctly no matter which line separator I use, i.e. it doesn't matter whether I use \n (the usual in Linux), \r\n (Windows) or even \r (which AFAIK is uncommon).

This is the app running in Racket v8.5 [cs] on Ubuntu 22.04 LTS:
crlf_linux

However, when I run the same code in Windows, both the "CRLF" and the "LF only" versions add unwanted blank lines at the end, apparently one per line. Only the weird "CR only" version does what I want.

Same app, Racket v8.5 [cs], Windows 10:
crlf_windows

The code I'm running:

#lang racket/gui

(define window-1 (new frame% [label "CRLF"] [width 256]))
(new message% [parent window-1] [label "Line 1\r\nLine 2\r\nLine 3"])
(send window-1 show #t)

(define window-2 (new frame% [label "CR only"] [width 256]))
(new message% [parent window-2] [label "Line 1\rLine 2\rLine 3"])
(send window-2 show #t)

(define window-3 (new frame% [label "LF only"] [width 256]))
(new message% [parent window-3] [label "Line 1\nLine 2\nLine 3"])
(send window-3 show #t)

I wouldn't have been surprised if Windows was only happy with the CRLF version, but just CR by itself seems like something's off. Is this expected behavior or an actual bug?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal racket/gui example using message% and reproduce the CRLF, LF, and CR cases on Windows and Ubuntu. Compare the rendered line endings across platforms; done means the supported newline forms no longer add unwanted blank lines or the behavior is clearly documented as expected.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.