]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix intraline lint patch rendering
authorvrana <jakubv@fb.com>
Sat, 23 Feb 2013 00:55:22 +0000 (16:55 -0800)
committervrana <jakubv@fb.com>
Sat, 23 Feb 2013 01:03:47 +0000 (17:03 -0800)
Summary: `,` -> `, ` is currently highlighted wrong.

Test Plan:
Looked at patches of these errors:

- License linter
- `0+0`
- `0,0`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5093

src/lint/renderer/ArcanistLintConsoleRenderer.php

index bb295b96fb78dfe3edc9c08272ab35c5d923a0a4..4a5920764af9f85379ed7839a86a959e63900e6a 100644 (file)
@@ -138,7 +138,9 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer {
     $text_lines = explode("\n", $text);
     $text_length = count($text_lines);
 
-    if ($text) {
+    $intraline = ($text != '' || $start || !preg_match('/\n$/', $patch));
+
+    if ($intraline) {
       for (; $cursor < $line_num + $text_length; $cursor++) {
         $chevron = ($cursor == $line_num);
         // We may not have any data if, e.g., the old file does not exist.
@@ -176,7 +178,7 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer {
 
       $patched = phutil_console_format('##%s##', $patch_line);
 
-      if ($text) {
+      if ($intraline) {
         $patched = substr_replace(
           $line_data[$line_num],
           $patched,