Transition to buffer.number setter

This commit is contained in:
Marco Sirabella 2019-11-22 18:25:50 -05:00
parent a6b955f4c7
commit d3f37d059c
No known key found for this signature in database
GPG key ID: 350CE23EFB20D1A7

View file

@ -372,7 +372,7 @@ class WeechatChannelBuffer(object):
if new_channel_position == NewChannelPosition.NONE:
pass
elif new_channel_position == NewChannelPosition.NEXT:
W.buffer_set(self._ptr, "number", str(cur_num + 1))
self.number = cur_num + 1
elif new_channel_position == NewChannelPosition.NEAR_SERVER:
server = G.SERVERS[server_name]
last_similar_buffer_num = max(
@ -380,7 +380,7 @@ class WeechatChannelBuffer(object):
in server.room_buffers.values()),
default=W.buffer_get_integer(server.server_buffer, "number")
)
W.buffer_set(self._ptr, "number", str(last_similar_buffer_num + 1))
self.number = last_similar_buffer_num + 1
self.name = ""
self.users = {} # type: Dict[str, WeechatUser]
@ -869,6 +869,10 @@ class WeechatChannelBuffer(object):
"""Get the buffer number, starts at 1."""
return int(W.buffer_get_integer(self._ptr, "number"))
@number.setter
def number(self, n):
W.buffer_set(self._ptr, "number", str(n))
def find_lines(self, predicate, max_lines=None):
lines = []
count = 0