summaryrefslogtreecommitdiffstats
path: root/gerrit-prettify
Commit message (Collapse)AuthorAgeFilesLines
* Set version to 2.7v2.7Dave Borowitz2013-09-181-1/+1
| | | | Change-Id: I49a7fc97fd6d4f199c25774faa50ec4a826ae64a
* Merge branch 'stable-2.6' into stable-2.7Shawn Pearce2013-07-052-5/+3
|\ | | | | | | | | | | | | | | * stable-2.6: Fix: NullPointerException of dashboard title Properly handle double click on external group in GroupTable Add plugin repositories section in the pom PrettyFormatter: Fix expand tab when syntax coloring is on.
| * PrettyFormatter: Fix expand tab when syntax coloring is on.Arnaud Fabre2013-07-012-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | prettify lost support for expanding tabs in r143 [1]. As a consequence, tab width preference is no longer honored. Gerrit now handles expanding tabs by itself in all cases, even if syntax coloring is active. [1] http://code.google.com/p/google-code-prettify/source/detail?r=143 Bug: issue 1872 Change-Id: I283a3620b1d130d3f66e56d3f202a5122d7a73b8
* | Merge branch 'stable-2.6' into stable-2.7Shawn Pearce2013-07-011-2/+2
|\| | | | | | | | | * stable-2.6: PrettyFormatter: Fix ArrayIndexOutOfBoundException with CRLF files.
| * PrettyFormatter: Fix ArrayIndexOutOfBoundException with CRLF files.Arnaud Fabre2013-06-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change I6d82ce322d401743a8de5ab8090b2adc43a909f5 added a workaround for a bug in prettify, by temporarily adding a space before each \n character. For files with CRLF line endings, this means replacing "\r\n" by "\r<space>\n", which prettify sees as two lines. This leads to a crash since Gerrit expects a consistent number of lines even after prettify. When Show Line Endings is active, the issue does not appear since \r are replaced with a specific markup, without any actual \r. Change-Id: I345e332225e449c6f26871476f1a07e67458da59
| * Gerrit 2.6v2.6Shawn Pearce2013-06-211-1/+1
| | | | | | | | Change-Id: I7b6704181bae0953d7de021611ff8e8a0165b93f
* | prettify: Move client-only classes to client packageShawn Pearce2013-05-057-6/+6
| | | | | | | | | | | | | | | | | | This cleans up a weird dependency in the build tree for any Buck based build. Most of these classes are meant only to be compiled for GWT and do not build at the server side. Maven allowed sloppy use of gwt-user, making it difficult to identify this earlier. Change-Id: Id86e74f2f0760c9853829483899379353e5ada13
* | Build gwtexpui from in-subtree versionDave Borowitz2013-04-111-2/+3
| | | | | | | | | | | | Rename the module and artifact to gerrit-gwtexpui. Change-Id: Ica1b7aae7777b4188d7d557a9e7fef0c37bca5c7
* | Start 2.7 developmentShawn Pearce2013-03-211-1/+1
|/ | | | Change-Id: I08dc590bb1f62af67d88eb11313d5d4cfe2423c4
* Add clarification comment in SparseFileContent.Range.toStringDavid Pursehouse2013-02-191-0/+1
| | | | | | | | | | | Change I34fb07f incorrectly "fixed" the brackets in the `toString` method, however the usage of [ and ) was intentional, to denote that the range is inclusive/exclusive. Add a short comment in the method to prevent the same mistake from being made again. Change-Id: Idfe9b560c0cc55bfa4a6ab06fba172d971c3089c
* Revert "Non-matching brackets in SparseFileContent.toString()"Shawn Pearce2013-02-191-1/+1
| | | | | | | This reverts commit 17daae9934941bc6db6b372a04433f19186d5972 The use of ) was intentional as the range is inclusive, exclusive. Change-Id: I1aa25b6d8a17a374766c6316ee1872c4272e609e
* Non-matching brackets in SparseFileContent.toString()Gustaf Lundh2013-02-181-1/+1
| | | | Change-Id: I34fb07f0e86ded375a160557d4a97ba88e1755c6
* Fix performance problem in side by side viewerShawn Pearce2013-02-041-2/+2
| | | | | | | | | | | | | Inserting "<lf>\n" doesn't work. Prettify leaves the <lf> but often inserts a <span> tag between <lf> and \n leaving a very deep tag stack for the DOM to handle. This is really slow to render and can cause mis-rendering. Insert a space before LF. Most prettify styles will treat this as the same as the LF, allowing the trailing space to be removed before splitting by line. Change-Id: I85d12c590a8d1bda1b1b66874a0dddb4628a8655
* Work around prettify stripping empty linesShawn Pearce2013-02-041-1/+2
| | | | | | | | | | | | Latest prettify build appears to delete empty lines from the end of the input file. This causes Gerrit to crash with array exceptions because the formatted HTML is a different length then the diff hunks indicate. Work around the broken prettify by inserting a fake HTML tag before each LF and removing it after formatting is complete. Change-Id: I6d82ce322d401743a8de5ab8090b2adc43a909f5
* Fix display of Commit MessageShawn Pearce2013-01-311-1/+1
| | | | | | If there are no HTML tags in the text, just break on lines. Change-Id: Ifead11e79af8db2a06c3824b7ab4877e51d2af03
* Update prettify to r225 (2013-01-17)Shawn Pearce2013-01-3025-166/+183
| | | | | | | | | | | | | | | | | | Local copy of the JavaScript was updated to include all supported languages: (cd gerrit-prettify/src/main/resources/com/google/gerrit/prettify/client/; for f in lang-*.js; do n=$(echo $f | sed 's,-,_,; s,.js,,'); echo " @Source(\"$f\") TextResource $n();"; done) >gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/Resources.java prettify no longer uses <br> for line breaks. It now inserts only an LF. This requires the post-processing parsing step to be updated and break on LF or HTML tags. Bug: issue 1155 Change-Id: I09c199f568a4579804790f7fa1548473419d14c2
* Fix ArrayIndexOutOfBoundsException on intraline diffEdwin Kempin2013-01-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases displaying the intraline diff fails with an exception like this: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 10 at com.google.gerrit.prettify.common.SparseFileContent.mapIndexToLine(SparseFileContent.java:149) at com.google.gerrit.prettify.common.PrettyFormatter.format(PrettyFormatter.java:188) at com.google.gerrit.client.patches.AbstractPatchContentTable.getSparseHtmlFileB(AbstractPatchContentTable.java:287) at com.google.gerrit.client.patches.SideBySideTable.render(SideBySideTable.java:113) at com.google.gerrit.client.patches.AbstractPatchContentTable.display(AbstractPatchContentTable.java:238) at com.google.gerrit.client.patches.PatchScreen.onResult(PatchScreen.java:444) ... This happens when the old line is: foo-old<LF> and the new line is: foo-new<CRLF> The computed intraline diff that should be highlighted for the new file will be 'new<CR>'. To do the highlighting 'span' tags are inserted which separates <CR> and <LF> for the new file. The prettify parser now replaces both with a 'br' tag. Since the number of 'br' tags is expected to match the number of lines and we now have one 'br' too much we run into the ArrayIndexOutOfBoundsException when looking up the lines. Avoid this problem by removing <CR> from the intraline diff before running the prettify parser. Bug: issue 1759 Change-Id: I738b1c780116b890d8db8bb0ab795c6b2b72128d Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
* Update versions in pom's to start Gerrit 2.6 developmentEdwin Kempin2012-08-221-1/+1
| | | | | Change-Id: I4fb8cb41250c5b640a8d9e47caf97dc4670ff428 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
* Fix ArrayIndexOutOfBoundsException on navigation to next/previous patchEdwin Kempin2012-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two ArrayIndexOutOfBoundsException's that can occur when navigating from one patch to the next/previous patch if the next/previous patch is a newly added binary file. 1. if the user is not signed in: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at com.google.gerrit.prettify.common.SparseFileContent.get(SparseFileContent.java:74) at com.google.gerrit.prettify.common.PrettyFormatter.colorLineEdits(PrettyFormatter.java:381) at com.google.gerrit.prettify.common.PrettyFormatter.toHTML(PrettyFormatter.java:315) at com.google.gerrit.prettify.common.PrettyFormatter.format(PrettyFormatter.java:129) at com.google.gerrit.client.patches.AbstractPatchContentTable.getSparseHtmlFileB(AbstractPatchContentTable.java:201) at com.google.gerrit.client.patches.UnifiedDiffTable.render(UnifiedDiffTable.java:99) ... 2. if the user is signed in and has 'Syntax Coloring' in the preferences enabled: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at com.google.gerrit.prettify.common.SparseFileContent.get(SparseFileContent.java:74) at com.google.gerrit.prettify.common.PrettyFormatter.toHTML(PrettyFormatter.java:319) at com.google.gerrit.prettify.common.PrettyFormatter.format(PrettyFormatter.java:129) at com.google.gerrit.client.patches.AbstractPatchContentTable.getSparseHtmlFileB(AbstractPatchContentTable.java:201) at com.google.gerrit.client.patches.UnifiedDiffTable.render(UnifiedDiffTable.java:99) ... Bug: issue 735 Change-Id: I43716b1c868e98c083b12e57b4686528634ae390 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
* Option to display line endingsPravin Sethia2012-07-304-4/+31
| | | | | | | | | | | | Displays Windows EOL/Cr-Lf on patch diff screen. This is optional and is controlled by a checkbox. A new column show_line_endings is added in account_diff_preferences. Display is similar to gitweb i.e. '\r' in dotted-line box Bug: issue 626 Change-Id: I6128575bd2f0869a3c59e3d2fd409d5ee431ecc5
* Remove timestamp from all org.eclipse.core.resources.prefs files.Sasa Zivkov2012-07-041-1/+0
| | | | | | | | | | | | | | | | | Eclipse overwrites these files when we import projects using m2e. Eclipse 3 writes a timestamp at the top of these files making the Git working tree dirty. Eclipse 4 (Juno) still overwrites these files but doesn't write the timestamp. This should help keeping the working tree clean. However, since the timestamp is currently present in these files, Eclispe 4 would still make them dirty by overwriting and effectively removing the timestamp. This change removes the timestamp from these files. This help those using Eclipse 4 and doesn't make it worse for those still using Eclispe 3. Change-Id: Ic23299a12ac80f7294bcc602c8565889069a0d10 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* Add Intellij IDEA files to ignore listAnatol Pomazau2012-05-031-1/+2
| | | | Change-Id: Ie948a1b3c9df95e79fc09ef343d0d49ff3b267c2
* Update parent version in pom.xml's to 2.5-SNAPSHOTEdwin Kempin2012-05-031-1/+1
| | | | | Change-Id: I3b2f0f532fc10b98657de117c80113fe0eac3bc4 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
* Change version in pom.xml to 2.4-SNAPSHOTSasa Zivkov2012-04-181-1/+1
| | | | | | | | The 2.3 was released and what we have in the master branch is targeted for 2.4. Change-Id: Idca8a12aaef1dc5ea5f628b3640881e66f04dc9c Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* Updated to gwtorm 1.4.Colby Ranger2012-03-071-1/+1
| | | | | | | | | | | | | Refactored the GWT client code to include only what the gerrit GWT client. The gerrit GWT build was giving build warnings since the getAsync() signature and implementation used types that were not available to GWT. Split the reviewdb into a client and server package. Organized the imports to ease the migration. Change-Id: I6cd6125eddcb1dd2b5c5e353edf163544248026b
* Update poms to Gerrit 2.3-SNAPSHOTv2.3-rc0Martin Fick2012-02-221-1/+1
| | | | Change-Id: I6f54a783959c58fb75114251e07a6871bc889904
* Add entries to .gitignore for m2e settings/preference filesMohan Zhang2011-12-121-0/+1
| | | | Change-Id: Ie70c285440b6200ad7f4dd8dea8a97317e1e62fc
* Fix diffs skipping one lineBrad Larson2011-10-261-2/+4
| | | | | | | | Don't show '... skipping 1 common line ...'. The text to show this takes up just as much space as showing the line which was skipped. Issue: 981 Change-Id: If86eb27dd6734a6826a9ceb379920c7c1d5e4692
* Updating eclipse settings for 3.7 and m2e 1.0Eric Anderson2011-07-292-2/+5
| | | | Change-Id: Ic0f134719769e3d8b8cfb6f70703f9a61fcd2538
* Only create source archives for packages that need oneShawn O. Pearce2011-06-021-0/+16
| | | | | | | | | | | | | | | We don't push our code to a Maven repository, so there only reason to construct source archives is to feed source files into the GWT compiler. Move the source plugin onto only the packages that we feed into the GWT code, allowing the others to skip this step. This fixes a "bug" in a later change that adds the Prolog Cafe translater to the build process. Without this change first, the Prolog Cafe translator is firing twice for every Prolog source file that is part of our standard build. Change-Id: Iba38aa371ce7c8950ac30dc3cf06e01b465afb5a Signed-off-by: Shawn O. Pearce <sop@google.com>
* Change version to 2.2-SNAPSHOTShawn O. Pearce2011-05-311-1/+1
| | | | | Change-Id: I1d3e6c42bc678536162a81d2b13372659a1c3dec Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix all of our pom.xml versions to be 2.1-SNAPSHOTShawn O. Pearce2010-08-121-1/+1
| | | | | | | | | | I meant to keep reusing the 2.1 version number for the entire 2.1 series during development, but botched it during the 2.1.4 development cycle and set it to 2.1.4-SNAPSHOT by mistake. Put it back to 2.1-SNAPSHOT since 2.1.4 is released. Change-Id: I37e206c0609bf3fd94a5aab8ea301c98b7fb013e Signed-off-by: Shawn O. Pearce <sop@google.com>
* Refactoring AccountDiffPreference vs PatchScriptSettings+PrettySettingsSasa Zivkov2010-07-214-121/+27
| | | | | | | | | | There was some code duplication in these classes. This refactoring removes the PatchScriptSettings and PrettySettings classes and uses AccountDiffPreference instead. Issue: bug 629 Change-Id: I57ab1522b0023503d0cbd29620236ea68b7717ed Signed-off-by: Sasa Zivkov <zivkov@gmail.com>
* Fix prettify private scope in IE6, IE8Shawn O. Pearce2010-07-144-32/+144
| | | | | | | | | | On IE6 or IE8 we can't abuse an IFrame quite the same way as we do on Mozilla, WebKit and Opera. IE requires us to initialize the iframe by running a script that exports the iframe window back to the parent before we can use its eval method. Change-Id: Ia5e01a611ed9685a5fc5341a3f8a2446f7dcb9f4 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Move prettify into its own iframeShawn O. Pearce2010-07-121-3/+13
| | | | | | | | | | | | | The prettify symbol 'PR' at the top level window object may conflict with a name created by the optimized GWT compiler, resulting in conflicting ideas about what the PR name really is and causing crashes in particular browsers. Move prettify into its own iframe, where it has its own top level window object, and thus has its own isolated namespace. Change-Id: I30523854067eb33250810e9d2f7e23b4c691541f Signed-off-by: Shawn O. Pearce <sop@google.com>
* Start 2.1.4 developmentShawn O. Pearce2010-06-211-1/+1
| | | | | Change-Id: I71719c85b0d50707333517b8ef956853b04efa14 Signed-off-by: Shawn O. Pearce <sop@google.com>
* gerrit 2.1.3v2.1.3Shawn O. Pearce2010-06-211-1/+1
| | | | | Change-Id: I93386d5b71e8361219c03d95ab7476dc46e7d6b0 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Handle bare CR in the middle of a linev2.1.2-rc3Shawn O. Pearce2010-03-093-6/+43
| | | | | | | | | | | | | | | Prettify converts a bare CR in the middle of a line of text into a <br/>, which we later convert back into an LF. This skews all of the line numbers through the rest of the file, resulting in a confusing situation (due to the unexpected LF) as we try to map the formatted HTML back into the SparseFileContent object we use for rendering. Highlight bare CRs as spaces with whitespace error spans around them, before we feed the text into prettify. This ensures we won't get back more lines than we fed in, so our formatting is still correct. Change-Id: Ib2dc8b024a2211601a588fd0552c4963d5b6e028 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix coloring of tab markers in syntax highlightingShawn O. Pearce2010-03-041-5/+36
| | | | | | | | | | If syntax highlighting is enabled the visual tab markers might adopt the surrounding code's coloring due to prettify pushing its own CSS class inside of our vt span. Override all of the prettify classes when inside of a vt span with our own concept of the correct color. Change-Id: I15ed9eb7348d5c4fb26f98332caed0194c6daefe Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix build breakage due to missing constantsShawn O. Pearce2010-03-012-0/+27
| | | | | | | | The parent commit should have included these new files, it references them to pick up the translated strings for the tooltips. Change-Id: I907436eeb9f717d6aed17757304e461fe888187c Signed-off-by: Shawn O. Pearce <sop@google.com>
* Use a tooltip to explain whitespace errorsShawn O. Pearce2010-03-012-2/+7
| | | | | | | | | Sometime users are confused about why Gerrit shows a particular part of the new file (which is always green) in red. Its a whitespace error, a case that isn't normal. Explain it with a tooltip message. Change-Id: Ide90f14c4a25eac5a2bcb1bc9f5e6d67e9ac4cb7 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix tab marker RIGHT-POINTING DOUBLE ANGLE QUOTATION MARKShawn O. Pearce2010-03-012-2/+5
| | | | | | | | | | | | | | | | | | Inserting the HTML entity confused the prettify engine when we were running in debug hosted mode. Instead of the Unicode character we expected, we got an ASCII "W". Use the actual character in the source code rather than the entity, this should reduce the risk that the prettify engine or the browser will become confused and misrender it. Also correct the coloring, now that its a real character prettify is converting it into a class named 'pun', which is contained within the 'vt' class we created. But if syntax highlighting is off that 'pun' class doesn't exist, so we need CSS selectors for both cases. Change-Id: I8ac03bf00cd4493ea53dcf3573cc2ba92455dfbf Signed-off-by: Shawn O. Pearce <sop@google.com>
* Use RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK for tabsShawn O. Pearce2010-03-012-3/+3
| | | | | | | | | | | This is the standard character to denote tabs in a file. Previously I was using a border line because it meant the tab would copy as a space when the user copied the line onto the clipboard, and they had no way to disable the visual tab indications. Now that we can turn off the tabs, its better to use a more widely recognized character. Change-Id: Idd6ffd4aff1c09b67f66efaf893b16f67bf1107a Signed-off-by: Shawn O. Pearce <sop@google.com>
* Change default tab width to 8Shawn O. Pearce2010-03-011-1/+1
| | | | | Change-Id: I32c777511b2ba8ac252ee5b82b581498de10fa9d Signed-off-by: Shawn O. Pearce <sop@google.com>
* Allow user to modify patch display settingsShawn O. Pearce2010-02-262-1/+23
| | | | | | | | | Users can now set the size of tabs, the number of columns displayed, and also toggle the various flags associated with our pretty printer like syntax coloring or intraline difference. Change-Id: Ic86894b76fdc7f7d5e8a494227e2e8a22dd3b1b1 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Always use class wdc on replace line common sectionsShawn O. Pearce2010-02-251-8/+4
| | | | | | | | | | | | | | | This way a common section in the middle of a replace line still works properly. For example consider: common NEW common NEW Because the line ends in NEW stuff, we'll apply wdi onto the entire table cell, which can cause that middle common to be showed as though it were also NEW. That's incorrect. By always applying the wdc class we can ensure we style that middle common the right way. Change-Id: Id3e551ce052df15e9dfea010ba6fb17f2cc1d64c Signed-off-by: Shawn O. Pearce <sop@google.com>
* Cleanup CSS for side-by-side view when there are character differencesShawn O. Pearce2010-02-242-8/+30
| | | | | | | | We no longer have gaps, but instead have a nice contiguous coloring region. The visual difference is night-and-day. Change-Id: I3e80a5860e62472713424dece49a018d584b3b65 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Ensure vertical tabs are visible within deleted regionsShawn O. Pearce2010-02-241-1/+2
| | | | | | | | | | Because we show tabs as red dotted lines, on a red background it can be hard to see. Use the heavier black dotted lines when the tab is within either a whitespace error region or within a deleted character region of a line. Change-Id: I7e317127659d19ba80c9c22e4b8245e467c64fad Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix SparseFileContent for delete-only patchesShawn O. Pearce2010-02-241-0/+4
| | | | | | | | | | If an edit list is only deletion regions, the B side will wind up with an empty range as there is no new content to include in the file. This is a corner case that means we have to always return false from contains(int) when there is no content. Change-Id: I745fa9ce2071acc2aa83bd84909477afeef0c3d4 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix whitespace ignore featureShawn O. Pearce2010-02-233-125/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we added full file content syntax highlighting on the client we broke the ignore whitespace feature, because the client was trying to recreate the complete file content for the B side using an edit list that came from the ignored whitespace difference, but was building from a sparse file content of B which was computed from the actual difference (that is, including whitespace). Although it seems like the edit list used shouldn't matter, the line indexes for the A side were thrown out of whack because different line ranges of B matched against A when whitespace was ignored. This caused us to be unable to locate a line of context in A that we expected to be present while trying to complete the sparse file content for B. The entire whitespace ignore logic has been vastly simplified. When packing content for B we now pack any context lines that differ from their matching line in A, thus ensuring we get the right variant for the side-by-side viewer to display. When pretty formatting a file, we no longer try to apply the edit list and hunk processing to the file contents, but instead do a direct walk over the line ranges available in the SparseFileContent. This lets us completely bypass the index lookups, eliminating the possibility for the bug we saw above. It also simplifies the logic quite a bit here, instead of trying to guess about what to format, we just format everything available. Change-Id: I24e0a8fab7fcbb85b6db6d35a9d04fe05d1b830d Signed-off-by: Shawn O. Pearce <sop@google.com>