1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00
phorge-phorge/webroot/rsrc/js/application
epriestley 21826ed7b3 Don't highlight very large files by default
Summary:
Ref T5644. See some discussion in D8040.

When a file is very large (more than 64KB of text), don't activate syntax highlighting by default. This should prevent us from wasting resources running `pygmentize` on enormous files.

Users who want the file highlighted can still select "Highlight As...".

The tricky part of this diff is separating the headers into "changeset" headers and "undershield" (rendering) headers. Specifically, a file might have these headers/shields:

  - "This file is newly added."
  - "This file is generated. Show Changes"
  - "Highlighting is disabled for this large file."

In this case, I want the user to see "added" and "generated" when they load the page, and only see "highlighting disabled" after they click "Show Changes". So there are several categories:

  - "Changeset" headers, which discuss the changeset as a whole (binary file, image file, moved, added, deleted, etc.)
  - "Property" headers, which describe metadata changes (not relevant here).
  - "Shields", which hide files from view by default.
  - "Undershield" headers, which provide rendering information that is only relevant if there is no shield on the file.

Test Plan:
  - Viewed a diff with the library map, clicked "show changes", got a "highlighting disabled" header back with highlighting disabled.
  - Enabled highlighting explicitly (this currently restores the shield, which it probably shouldn't, but that feels out of scope for this change). The deshielded file is highlighted per the user's request.
  - Loaded context on normal files.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: joshuaspence, epriestley

Maniphest Tasks: T5644

Differential Revision: https://secure.phabricator.com/D12132
2015-03-24 05:26:39 -07:00
..
aphlict Conpherence - fix 0 messages in header race condition 2015-03-16 14:28:25 -07:00
auth Add Persona auth provider 2013-10-14 14:34:57 -07:00
config Remove unused JavaScript variables. 2014-06-24 03:27:47 +10:00
conpherence Conpherence - fix a typo 2015-03-17 17:01:33 -07:00
countdown Define JavaScript functions before they are used 2014-12-30 02:53:32 -08:00
dashboard Fix various spelling mistakes 2014-07-13 00:45:33 +10:00
differential Don't highlight very large files by default 2015-03-24 05:26:39 -07:00
diffusion Fix scrolling behavior in Diffusion 2015-01-29 10:20:35 -08:00
doorkeeper Various linter fixes. 2014-02-26 12:44:58 -08:00
files Various linter fixes. 2014-02-26 12:44:58 -08:00
herald Herald - add support for application emails. 2015-01-29 14:15:38 -08:00
maniphest Fix Maniphest Reports scrolling issues 2015-02-24 09:41:37 -08:00
owners Change double quotes to single quotes in JavaScript. 2014-06-24 03:35:39 +10:00
passphrase Rename Passphrase credential control JS 2015-03-02 13:01:00 -08:00
phame Remove unused JavaScript variables. 2014-06-24 03:27:47 +10:00
pholio Fix next_src being defined as a global variable 2014-12-30 02:56:50 -08:00
phortune Remove support for Balanced payments 2015-03-13 15:47:37 -07:00
policy Mostly modernize the policy control typeahead 2014-07-17 15:56:20 -07:00
ponder Remove unused JavaScript variables. 2014-06-24 03:27:47 +10:00
projects Workboards - on edit, remove a task if no longer associated with workboard 2015-01-06 13:28:35 -08:00
releeph Make scrolling happen relative to the main content frame 2015-01-25 08:42:40 -08:00
repository Remove unused JavaScript variables. 2014-06-24 03:27:47 +10:00
search Remove unused JavaScript variables. 2014-06-24 03:27:47 +10:00
slowvote Replace the primary scrollbar with a fake one to prepare for a persistent chat column 2015-01-23 13:29:15 -08:00
transactions Fix anchor-clicking scroll positions 2015-01-28 08:26:10 -08:00
uiexample Use window.confirm instead of confirm 2014-12-30 02:55:12 -08:00