Page MenuHomePhabricator

Task descriptions with leading newlines are not preserved correctly across edits
Closed, ResolvedPublic

Description

See T8705, I simply added a project, and it says I edited the description. Clicking on the 'description change' edit link also acts oddly.

Event Timeline

chad raised the priority of this task from to Needs Triage.
chad updated the task description. (Show Details)
chad added a project: Maniphest.
chad added a subscriber: chad.

To reproduce:

  • Create a task with leading newlines in the task description.
  • Use "Edit Task" to adjust any other field.
epriestley renamed this task from I didn't edit the task description to Task descriptions with leading newlines are not preserved correctly across edits.Jun 29 2015, 5:13 PM
epriestley triaged this task as Wishlist priority.Jun 30 2015, 2:26 PM

I spent 3 seconds on this and couldn't immediately identify the root cause.

Apparently this is just how <textarea> works. Here's a test case in WebKit explicitly testing this behavior:

http://trac.webkit.org/browser/trunk/LayoutTests/fast/forms/textarea-newline.html?rev=82656

Here's discussion of this issue in Rails, although it's open source so it's 9000 pages long of people yelling at each other and I can't figure out what actually happened:

https://github.com/rails/rails/issues/393

I think this is the fix, which just adds a "\n" at he beginning:

https://github.com/rails/rails/commit/a4e4d2855bbad1c1400fb89ba663f7193d76dc10

...although this was later reverted and replaced with crazy nonsense with approximately the same effect because of something called "HAML":

https://github.com/rails/rails/commit/33164c8f1479b826a044ab90f4cc2439666e4b16

...which persists to this day:

https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/tag_helper.rb#L25

So it's probably fine to just do that.