bugfix: when there is no selected text textbuffer.get_selection_bounds() return ()
This commit is contained in:
parent
d9377d6aae
commit
e5f9884867
1 changed files with 8 additions and 6 deletions
|
@ -412,12 +412,14 @@ class chat:
|
||||||
#we get the end of the tag
|
#we get the end of the tag
|
||||||
while not end_iter.ends_tag(texttag):
|
while not end_iter.ends_tag(texttag):
|
||||||
end_iter.forward_char()
|
end_iter.forward_char()
|
||||||
begin_sel, end_sel = widget.get_buffer().get_selection_bounds()
|
bounds = widget.get_buffer().get_selection_bounds()
|
||||||
if begin_sel.in_range(begin_iter, end_iter) or\
|
if len(bounds) == 2:
|
||||||
end_sel.in_range(begin_iter, end_iter):
|
begin_sel, end_sel = bounds
|
||||||
# we have selected a text and release the button in an url, we don't
|
if begin_sel.in_range(begin_iter, end_iter) or\
|
||||||
# want to open the url
|
end_sel.in_range(begin_iter, end_iter):
|
||||||
return
|
# we have selected a text and release the button in an url, we
|
||||||
|
# don't want to open the url
|
||||||
|
return
|
||||||
word = begin_iter.get_text(end_iter)
|
word = begin_iter.get_text(end_iter)
|
||||||
if event.button == 3:
|
if event.button == 3:
|
||||||
self.make_link_menu(event, kind, word)
|
self.make_link_menu(event, kind, word)
|
||||||
|
|
Loading…
Add table
Reference in a new issue