fixed a small issue when focusing chat messages

This commit is contained in:
Manuel Cortez 2021-04-21 10:31:53 -05:00
parent aeade1cc2c
commit 6bce7b956e
2 changed files with 7 additions and 4 deletions

View File

@ -11,6 +11,7 @@
### bugfixes
* Fixed an issue when focusing chat messages. Sometimes, socializer was not precise enough to focus the right message. Now all messages should be getting the focus as expected.
* Fixed a small issue that was making impossible to close the blacklist dialog by pressing escape.
* Now it is possible to perform authentication in accounts using two factor verification again. This issue was caused due to a recent change in the VK workflow for two factor verification processes.
* Users who have chosen to not show their online activity (specifically the last seen field in VK) will be added in people buffers. Before, those people were making socializer to raise an exception and the whole buffer was unable to be loaded.

View File

@ -1100,17 +1100,19 @@ class chatBuffer(baseBuffer):
def get_focused_post(self):
""" Gets chat message currently in focus"""
# this function replaces self.get_post for normal buffers, as we rely in a TextCtrl control for getting chats.
# this function replaces self.get_post for this buffer, as we rely in a TextCtrl control for getting chats.
# Instead of the traditional method to do the trick.
# Get text position here.
position = self.tab.history.PositionToXY(self.tab.history.GetInsertionPoint())
id_ = None
for i in list(self.chats.keys()):
# The dictionary keys should be looked in reverse order as we are interested in the last result only.
for i in reversed(list(self.chats.keys())):
# Check if position[2] (line position) matches with something in self.chats
# (All messages, except the last one, should be able to be matched here).
# position[2]+1 is added because line may start with 0, while in wx.TextCtrl.GetNumberLines() that is not possible.
if position[2]+1 >= i[0] and position[2]+1 < i[1]:
# position[2]+1 is added because line may start with 0, while in wx.TextCtrl.GetNumberOfLines() it returns a value counting from 1.
if position[2]+1 >= i[0]:
id_ = self.chats[i]
# If we find our chat message, let's skip the rest of the loop.
break
# Retrieve here the object based in id_
if id_ != None: