Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !7222

Merged
Created Jun 27, 2014 by Administrator@rootOwner

Don't remove trailing newline when editing a file in web UI editor

  • Overview 6
  • Commits 1
  • Changes 2

Created by: jhund

What does this MR do?

It addresses an issue where editing a file through the web UI (ACE editor) removes trailing newlines from the edited file.

The current implementation populates the ACE editor’s contents via the inner text of the pre#editor html tag. Since whitespace is not significant in HTML, any trailing newlines are lost when the ACE editor loads its contents from the HTML element. When the user saves the edits, the new file doesn’t have a trailing newline any more.

This commit changes how the editor’s content is populated to use the editor’s editor.setValue(); Javascript API method. Using the API preserves trailing newlines.

Why was this MR needed?

Because editing content via gitlab’s web UI should not strip the edited file’s trailing newlines.

What are the relevant issue numbers / Feature requests?

  • #5936 (closed)
  • This fix makes the workaround in gitlabhq/app/controllers/projects/edit_tree_controller.rb#preview obsolete.
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/jhund/fix-5936