pymud 0.21.2a1__py3-none-any.whl → 0.21.2a2__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/extras.py CHANGED
@@ -276,33 +276,35 @@ class VSplitWindow(Window):
276
276
 
277
277
  else:
278
278
  # 有split window
279
- # 复制上半部分,正序复制,确保即使有自动折行时,第一行也保持在屏幕最顶部
280
- lineno = start_lineno
281
- while y < upper and lineno < line_count:
282
- line = ui_content.get_line(lineno)
283
- visible_line_to_row_col[y] = (lineno, horizontal_scroll)
284
- x = 0
285
- x, y = copy_line(line, lineno, x, y, is_input=True)
286
- lineno += 1
287
- y += 1
279
+
288
280
 
289
- # x = 0
290
- # x, y = copy_line([("","-"*width)], lineno, x, y, is_input=False)
291
- # y += 1
292
281
 
293
- # 复制下半部分,倒序复制,确保即使有自动折行时,最后一行也保持在屏幕最底部
282
+ # 先复制下半部分,倒序复制,确保即使有自动折行时,最后一行也保持在屏幕最底部
294
283
  y = total
295
284
  lineno = line_count
296
285
 
297
- while y >= below and lineno >= 0:
286
+ while y > below and lineno >= 0:
298
287
  lineno -= 1
299
288
  # Take the next line and copy it in the real screen.
300
289
  display_lines = ui_content.get_height_for_line(lineno, width, None)
301
290
  y -= display_lines
291
+ if y <= below:
292
+ break
302
293
  line = ui_content.get_line(lineno)
303
294
  visible_line_to_row_col[y] = (lineno, horizontal_scroll)
304
295
  copy_line(line, lineno, 0, y, is_input=True)
305
296
 
297
+ # 复制上半部分,正序复制,确保即使有自动折行时,第一行也保持在屏幕最顶部
298
+ y = -vertical_scroll_2
299
+ lineno = start_lineno
300
+ while y <= below and lineno < line_count:
301
+ line = ui_content.get_line(lineno)
302
+ visible_line_to_row_col[y] = (lineno, horizontal_scroll)
303
+ x = 0
304
+ x, y = copy_line(line, lineno, x, y, is_input=True)
305
+ lineno += 1
306
+ y += 1
307
+
306
308
  # 最后复制分割线,若上下有由于折行额外占用的内容,都用分割线给覆盖掉
307
309
  copy_line([("","-"*width)], -1, 0, upper + 1, is_input=False)
308
310
 
pymud/pymud.py CHANGED
@@ -9,7 +9,7 @@ from prompt_toolkit.buffer import Buffer
9
9
  from prompt_toolkit.application import Application
10
10
  from prompt_toolkit.filters import Condition
11
11
  from prompt_toolkit.key_binding import KeyBindings
12
- from prompt_toolkit.layout import ConditionalContainer, Float, VSplit, HSplit, Window, WindowAlign, ScrollbarMargin, NumberedMargin
12
+ from prompt_toolkit.layout import ConditionalContainer, Float, VSplit, HSplit, Window, WindowAlign, ScrollbarMargin, NumberedMargin, to_dimension
13
13
  from prompt_toolkit.layout.layout import Layout
14
14
  from prompt_toolkit.layout.controls import FormattedTextControl
15
15
  from prompt_toolkit.layout.dimension import D
@@ -398,11 +398,26 @@ class PyMudApp:
398
398
  else:
399
399
  b = None
400
400
 
401
- if isinstance(b, Buffer):
401
+ if isinstance(b, SessionBuffer):
402
402
  if lines < 0:
403
- b.cursor_up(-1 * lines)
404
- elif lines > 0:
405
- b.cursor_down(lines)
403
+ if b.start_lineno < 0:
404
+ self.console._scroll_up()
405
+ b.start_lineno = b.lineCount - self.get_height() * 3 // 2
406
+ else:
407
+ b.start_lineno += lines
408
+ if b.start_lineno < 0:
409
+ b.start_lineno = 0
410
+
411
+ else:
412
+ if b.start_lineno < 0:
413
+ return
414
+
415
+ b.start_lineno += lines
416
+
417
+ if b.start_lineno >= b.lineCount - self.get_height():
418
+ b.start_lineno = -1
419
+
420
+
406
421
 
407
422
  def page_up(self, event: KeyPressEvent) -> None:
408
423
  "快捷键PageUp: 用于向上翻页。翻页页数为显示窗口行数的一半减去一行。"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymud
3
- Version: 0.21.2a1
3
+ Version: 0.21.2a2
4
4
  Summary: a MUD Client written in Python
5
5
  Author-email: "newstart@pkuxkx" <crapex@hotmail.com>
6
6
  Maintainer-email: "newstart@pkuxkx" <crapex@hotmail.com>
@@ -66,7 +66,7 @@ Dynamic: license-file
66
66
 
67
67
  ## 版本更新信息
68
68
 
69
- ### 0.22.0 (2025-05-27) 本版传错了,已无法使用。
69
+ ### 0.22.0 (2025-05-31) 本版传错了,已无法使用。
70
70
 
71
71
  + 问题修复: 修复了当自动重连启动时,即使会话关闭了,也会自动重连的问题。
72
72
  + 实现调整: 重写了专用的SessionBuffer与SessionBufferControl,降低内存使用。
@@ -2,7 +2,7 @@ pymud/__init__.py,sha256=oeHz0NM7_DwChCY8f_vQ_fBq0e_HoTd0cahCFwaavWE,806
2
2
  pymud/__main__.py,sha256=lIOBiJmi8X-EWXVIx_OoxSgUZ0FYKlZI8hXVnLUYTJQ,61
3
3
  pymud/decorators.py,sha256=XaxcZqHw4s44lC2EAgB5kZmbNvJnHGmpZnoW75tUeNY,9844
4
4
  pymud/dialogs.py,sha256=4kHycr47UgKQUHGX-KMZvERuWViPjT4hNrGhbe4j-NU,7056
5
- pymud/extras.py,sha256=b0D7dblleQKKuGRW7TMQadqfG-UPSbVgAHVTV05CzQg,35602
5
+ pymud/extras.py,sha256=aXpxgcJxwMzREKV66ltbxpQiYbyDJKGuO3AJYhDmZy0,35599
6
6
  pymud/i18n.py,sha256=qLgvrmYhVfkTHKpbBR-LfYMOrGgi0skHrelbsj7ItbE,3034
7
7
  pymud/logger.py,sha256=WCsfXVkgl63qdq1RQEDJBnM7U0S6u8TeORFSMhcoydI,5840
8
8
  pymud/main.py,sha256=zaSjNhpbX3FMulKg-UNFrdiIJO8sOmmrUQrkPOalB-4,10224
@@ -10,14 +10,14 @@ pymud/modules.py,sha256=DoCregng5iAj_Hq_yUvRPreRTv2Ehb6sV6_4jfdbsik,11912
10
10
  pymud/objects.py,sha256=ZOxNjlPD_d4jk5DMBcXgYcvkt9d8xZih0IQtQlA3f1Y,38668
11
11
  pymud/pkuxkx.py,sha256=qDVry-Vd6MNui0NKWZFT52IpmP1sKS5Dz74EDY4tVGQ,14740
12
12
  pymud/protocol.py,sha256=KNKJYj9HFRoUy-jigNfhiQdDOM_kRSJE17QFpBarQTg,48335
13
- pymud/pymud.py,sha256=TEN8xwWjOyMSMEhEVhYBzEe4S7sH8wzgokP19mIhlg4,53058
13
+ pymud/pymud.py,sha256=RSq0Nj0UJHrbsuLDYN-s3KmguBmn0YrhCN33i1zENGM,53529
14
14
  pymud/session.py,sha256=K7AUm6JcTryEvknZnMrvS-UfNEDFyMZSD7yiRXivLRM,155063
15
15
  pymud/settings.py,sha256=S2sBEM7YtaDOVu3UpGfHBaU7zSB3Zhs7w-Z7PtdS0WQ,7697
16
16
  pymud/lang/i18n_chs.py,sha256=2cyaHHLwpYEBBwuQXyRTxa1opX53fTv1f8_QDQeGlC0,16836
17
17
  pymud/lang/i18n_eng.py,sha256=jcPz6Y5UuxJBQLY_e8UnEF3GYTlnAD44C14Oj7sK-QI,45935
18
- pymud-0.21.2a1.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
19
- pymud-0.21.2a1.dist-info/METADATA,sha256=UGS0dauMo_3wXg4Az_lhkYsfTz_ivEdlKD8EIfZw6QM,44840
20
- pymud-0.21.2a1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- pymud-0.21.2a1.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
22
- pymud-0.21.2a1.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
23
- pymud-0.21.2a1.dist-info/RECORD,,
18
+ pymud-0.21.2a2.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
19
+ pymud-0.21.2a2.dist-info/METADATA,sha256=FRQF7ACh0pzWQRcP7Nsyo-IZE4jb6ilcSRv9ZaL92-M,44840
20
+ pymud-0.21.2a2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ pymud-0.21.2a2.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
22
+ pymud-0.21.2a2.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
23
+ pymud-0.21.2a2.dist-info/RECORD,,