|
7 | 7 | # Required for Questions Panel |
8 | 8 | import os |
9 | 9 | import time |
| 10 | +import locale |
10 | 11 | from collections import defaultdict |
11 | 12 | from simple_term_menu import TerminalMenu |
12 | 13 | import webbrowser |
13 | | -import time |
14 | 14 |
|
15 | 15 | from .error import SearchError |
16 | 16 | from .save import SaveSearchResults |
@@ -106,7 +106,7 @@ def add_to_playbook(self, stackoverflow_object, question_id): |
106 | 106 | """ |
107 | 107 | if self.is_question_in_playbook(question_id): |
108 | 108 | SearchError("Question is already in the playbook", "No need to add") |
109 | | - sys.exit() |
| 109 | + return |
110 | 110 | for question in stackoverflow_object.questions_data: |
111 | 111 | if(int(question[1])==int(question_id)): |
112 | 112 | content = self.playbook_content |
@@ -209,9 +209,10 @@ def return_formatted_ans(self, ques_id): |
209 | 209 | with console.capture() as capture: |
210 | 210 | console.print(markdown) |
211 | 211 | highlighted = capture.get() |
212 | | - box_replacement = [("─", "-"), ("═","="), ("║","|"), ("│", "|"), ('┌', '+'), ("└", "+"), ("┐", "+"), ("┘", "+"), ("╔", "+"), ("╚", "+"), ("╗","+"), ("╝", "+"), ("•","*")] |
213 | | - for convert_from, convert_to in box_replacement: |
214 | | - highlighted = highlighted.replace(convert_from, convert_to) |
| 212 | + if locale.getlocale()[1] !='UTF-8': |
| 213 | + box_replacement = [("─", "-"), ("═","="), ("║","|"), ("│", "|"), ('┌', '+'), ("└", "+"), ("┐", "+"), ("┘", "+"), ("╔", "+"), ("╚", "+"), ("╗","+"), ("╝", "+"), ("•","*")] |
| 214 | + for convert_from, convert_to in box_replacement: |
| 215 | + highlighted = highlighted.replace(convert_from, convert_to) |
215 | 216 | return highlighted |
216 | 217 |
|
217 | 218 | def navigate_questions_panel(self, playbook=False): |
|
0 commit comments