From 8ec038291a9e6eeace7c072a347930af0f949522 Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 22 Feb 2013 16:55:22 -0800 Subject: [PATCH] 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 --- src/lint/renderer/ArcanistLintConsoleRenderer.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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,