SideBySide2: Defer syntax highlighting on large files
If a file contains more than 500 lines on either side defer syntax highlighting by 250 milliseconds. This gives the browser a chance to get the file opened and visible on screen before the active mode starts chugging through the text building up the DOM. Users see the file appear, and then CM3 highlights the visible region and colors fill in slightly later. This gives the UI a slightly more responsive feeling while still offering users the syntax highlighting they want visible. Change-Id: I86307406b93690d864e9fa652b19157667a75a82
This commit is contained in:
committed by
Colby Ranger
parent
b6bfd66887
commit
d62a6a94a4
@@ -132,12 +132,14 @@ public class GetDiff implements RestReadView<FileResource> {
|
||||
result.metaA = new FileMeta();
|
||||
result.metaA.name = Objects.firstNonNull(ps.getOldName(), ps.getNewName());
|
||||
result.metaA.setContentType(ps.getFileModeA(), ps.getMimeTypeA());
|
||||
result.metaA.lines = ps.getA().size();
|
||||
}
|
||||
|
||||
if (ps.getDisplayMethodB() != DisplayMethod.NONE) {
|
||||
result.metaB = new FileMeta();
|
||||
result.metaB.name = ps.getNewName();
|
||||
result.metaB.setContentType(ps.getFileModeB(), ps.getMimeTypeB());
|
||||
result.metaB.lines = ps.getB().size();
|
||||
}
|
||||
|
||||
if (intraline) {
|
||||
@@ -179,7 +181,7 @@ public class GetDiff implements RestReadView<FileResource> {
|
||||
static class FileMeta {
|
||||
String name;
|
||||
String contentType;
|
||||
String url;
|
||||
Integer lines;
|
||||
|
||||
void setContentType(FileMode fileMode, String mimeType) {
|
||||
switch (fileMode) {
|
||||
|
||||
Reference in New Issue
Block a user