pymud 0.18.4__py3-none-any.whl → 0.18.4.post1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pymud/session.py CHANGED
@@ -105,7 +105,7 @@ class Session:
105
105
  self.buffer_pos_view = 0 # 标注查看位置光标指针
106
106
  self.buffer_pos_view_line = -1
107
107
  self.showHistory = False # 是否显示历史
108
-
108
+ self._line_count = 0 # 快速访问行数
109
109
  self._status_maker = None # 创建状态窗口的函数(属性)
110
110
  self.display_line = ""
111
111
 
@@ -333,14 +333,19 @@ class Session:
333
333
  "将数据写入到用于本地显示的缓冲中"
334
334
  self.buffer.insert_text(data)
335
335
 
336
+ if data[-1] == "\n":
337
+ self._line_count += 1
338
+
336
339
  if newline:
337
340
  self.buffer.insert_text(self.newline_cli)
341
+ self._line_count += 1
338
342
 
339
343
  def clear_buffer(self):
340
344
  "清除过多缓冲"
341
- if self.buffer.document.is_cursor_at_the_end and (self.buffer.document.line_count >= 2 * Settings.client["buffer_lines"]):
345
+ if (self._line_count >= 2 * Settings.client["buffer_lines"]) and self.buffer.document.is_cursor_at_the_end:
342
346
  startindex = self.buffer.document.translate_row_col_to_index(-1 * Settings.client["buffer_lines"], 0)
343
- self.buffer.text = self.buffer.document.text[startindex:]
347
+ self.buffer.text = self.buffer.document.text[startindex:]
348
+ self._line_count = self.buffer.document.line_count
344
349
 
345
350
  def feed_data(self, data) -> None:
346
351
  "永远只会传递1个字节的数据,以bytes形式"
@@ -376,7 +381,7 @@ class Session:
376
381
  def go_ahead(self) -> None:
377
382
  "把当前接收缓冲内容放到显示缓冲中"
378
383
  self.clear_buffer()
379
-
384
+
380
385
  raw_line = self._line_buffer.decode(self.encoding, Settings.server["encoding_errors"])
381
386
  tri_line = self.getPlainText(raw_line, trim_newline = True)
382
387
  self._line_buffer.clear()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymud
3
- Version: 0.18.4
3
+ Version: 0.18.4.post1
4
4
  Summary: a MUD Client written in Python
5
5
  Author-email: "newstart@pkuxkx" <crapex@crapex.cc>
6
6
  Maintainer-email: "newstart@pkuxkx" <crapex@crapex.cc>
@@ -907,3 +907,6 @@ Requires-Dist: prompt-toolkit
907
907
  ### 0.18.4 (2024-02-19)
908
908
  + 功能新增:新增Settings.client["buffer_lines"],表示保留的缓冲行数(默认5000)。当Session内容缓冲行数达到该值2倍时(10000行),将截取一半(5000行),后一半内容进行保留,前一半丢弃。此功能是为了减少长时挂机的内存消耗和响应时间。
909
909
  + 功能修复:解决在显示美化(Settings.client["beautify"])打开之后,复制部分文字不能正确判断起始终止的问题。
910
+
911
+ ### 0.18.4post1 (2024-02-19)
912
+ + 功能调整:修改缓冲行数判断逻辑,加快客户端判断响应速度。
@@ -6,11 +6,11 @@ pymud/objects.py,sha256=2qnrNI_891y-Wo6Z0xjoPcbJSfrPLbyZOmUNXMsYAz0,28983
6
6
  pymud/pkuxkx.py,sha256=_CR4ETm-ihl5ZqznB75-pT3NdZSfUiuOsvEh5MwSjHI,11417
7
7
  pymud/protocol.py,sha256=F96Yq-1YO_5GN6QnJ4vMdNjCAzejVmDdsfrJguCjCeE,49120
8
8
  pymud/pymud.py,sha256=wzRTMFoJSPol6H-G6CXvgK7j5n1aIvTkxnkrEvBIrn4,38587
9
- pymud/session.py,sha256=i7SZEdbhn5vePO2VjJhHYSHN4Adq0MbMGuN_q4lBJ7g,71059
9
+ pymud/session.py,sha256=tepG3Y2Pe1eQkYw5FtFq8cq2NkmLnEF31A1YQQqMgy4,71297
10
10
  pymud/settings.py,sha256=WUxwN6zh7k_uB2SDHQFFO1Qeg2T1aJqxGASFI_pIHFc,6557
11
- pymud-0.18.4.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
- pymud-0.18.4.dist-info/METADATA,sha256=2F7ZvwvEQ6JM-uHTmH3lXJh8R4x42fpPaTUQulyM_kU,63029
13
- pymud-0.18.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
14
- pymud-0.18.4.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
15
- pymud-0.18.4.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
16
- pymud-0.18.4.dist-info/RECORD,,
11
+ pymud-0.18.4.post1.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ pymud-0.18.4.post1.dist-info/METADATA,sha256=0cv_q7GEbfs157hTavRhVLk9C8RD9PTdT2i2gaUNnQA,63155
13
+ pymud-0.18.4.post1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
14
+ pymud-0.18.4.post1.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
15
+ pymud-0.18.4.post1.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
16
+ pymud-0.18.4.post1.dist-info/RECORD,,