Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Münchbach <182-FlorianMuenchbach@users.noreply.dev.gajim.org>2019-02-18 21:01:18 +0300
committerFlorian Münchbach <182-FlorianMuenchbach@users.noreply.dev.gajim.org>2019-02-18 21:04:00 +0300
commit337522ddaf67bfb180562628d742e065372c2a58 (patch)
treee42eadf08dd885b63c6c2da139ee6b81988290f0
parent486f69afde0680daf2fe3e0e370ac677b3632318 (diff)
[syntax_highlight] Fix code blocks spreading from corrected to following messages
-rw-r--r--syntax_highlight/chat_syntax_highlighter.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/syntax_highlight/chat_syntax_highlighter.py b/syntax_highlight/chat_syntax_highlighter.py
index 9fd888e..cc402f7 100644
--- a/syntax_highlight/chat_syntax_highlighter.py
+++ b/syntax_highlight/chat_syntax_highlighter.py
@@ -209,7 +209,7 @@ class ChatSyntaxHighlighter:
# insertion invalidates iterator, let's use our start mark...
self.insert_and_format_code(buf, text_to_insert, language,
- marker_widths, start_mark, other_tags)
+ marker_widths, start_mark, end_mark, other_tags)
iterator = buf.get_iter_at_mark(end_mark)
# the current end of the buffer's contents is the start for the
@@ -226,7 +226,9 @@ class ChatSyntaxHighlighter:
# print_special_text method is resetting the plugin_modified variable...
self.textview.plugin_modified = True
- def insert_and_format_code(self, buf, insert_text, language, marker, start_mark, other_tags=None):
+ def insert_and_format_code(self, buf, insert_text, language, marker,
+ start_mark, end_mark, other_tags=None):
+
start_iter = buf.get_iter_at_mark(start_mark)
if other_tags:
@@ -237,7 +239,7 @@ class ChatSyntaxHighlighter:
start_iter = buf.get_iter_at_mark(start_mark)
tag_start = start_iter
- tag_end = buf.get_end_iter()
+ tag_end = buf.get_iter_at_mark(end_mark)
s_code = start_iter.copy()
e_code = tag_end.copy()
s_code.forward_chars(marker[0])
@@ -256,7 +258,7 @@ class ChatSyntaxHighlighter:
tag.set_property('paragraph-background', self.config.get_bgcolor())
tag.set_property('font', self.config.get_font())
buf.get_tag_table().add(tag)
- buf.apply_tag(tag, start_iter, buf.get_end_iter())
+ buf.apply_tag(tag, start_iter, tag_end)
def __init__(self, config, textview):
self.last_end_mark = None