diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 4916de48..46fdc1b2 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -411,7 +411,11 @@ class PRDescription: {filename} {file_change_description_br} - + + + + + {diff_plus_minus}{delta_nbsp} @@ -467,10 +471,6 @@ def insert_br_after_x_chars(text, x=70): is_saved_word = False if word == "" or word == "" or word == "
  • " or word == "
    ": is_saved_word = True - if "" in word: - is_inside_code = True - if "" in word: - is_inside_code = False len_word = count_chars_without_html(word) if not is_saved_word and (current_length + len_word > x): @@ -487,6 +487,10 @@ def insert_br_after_x_chars(text, x=70): if word == "
  • " or word == "
    ": current_length = 0 + if "" in word: + is_inside_code = True + if "" in word: + is_inside_code = False return ''.join(new_text).strip() def replace_code_tags(text): diff --git a/tests/unittest/test_convert_to_markdown.py b/tests/unittest/test_convert_to_markdown.py index 72d34656..36b0371d 100644 --- a/tests/unittest/test_convert_to_markdown.py +++ b/tests/unittest/test_convert_to_markdown.py @@ -112,9 +112,17 @@ class TestBR: 'ColorPaletteResourcesCollection ColorPaletteResourcesCollection`') file_change_description_br = insert_br_after_x_chars(file_change_description) expected_output = ('
  • Created a - new -class ColorPaletteResourcesCollection
    ' - 'ColorPaletteResourcesCollection ColorPaletteResourcesCollection
    ' - 'ColorPaletteResourcesCollection
    ') + 'ColorPaletteResourcesCollection ColorPaletteResourcesCollection ' + '
    ColorPaletteResourcesCollection') assert file_change_description_br == expected_output # print("-----") # print(file_change_description_br) + def test_br3(self): + file_change_description = 'Created a new class `ColorPaletteResourcesCollection` which extends `AvaloniaDictionary` and implements aaa' + file_change_description_br = insert_br_after_x_chars(file_change_description) + assert file_change_description_br == ('Created a new class ColorPaletteResourcesCollection which ' + 'extends
    AvaloniaDictionary' + ' and implements
    aaa') + # print("-----") + # print(file_change_description_br)