From: vrana Date: Sat, 23 Feb 2013 00:55:22 +0000 (-0800) Subject: Fix intraline lint patch rendering X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=8ec038291a9e6eeace7c072a347930af0f949522;p=arcanist.git Fix intraline lint patch rendering 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 --- diff --git a/src/lint/renderer/ArcanistLintConsoleRenderer.php b/src/lint/renderer/ArcanistLintConsoleRenderer.php index bb295b96..4a592076 100644 --- a/src/lint/renderer/ArcanistLintConsoleRenderer.php +++ b/src/lint/renderer/ArcanistLintConsoleRenderer.php @@ -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,