pymud 0.21.4.post4__py3-none-any.whl → 0.21.5__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 +38 -16
- pymud/pymud.py +3 -6
- pymud/session.py +3 -0
- pymud/settings.py +1 -1
- {pymud-0.21.4.post4.dist-info → pymud-0.21.5.dist-info}/METADATA +7 -1
- {pymud-0.21.4.post4.dist-info → pymud-0.21.5.dist-info}/RECORD +10 -10
- {pymud-0.21.4.post4.dist-info → pymud-0.21.5.dist-info}/WHEEL +0 -0
- {pymud-0.21.4.post4.dist-info → pymud-0.21.5.dist-info}/entry_points.txt +0 -0
- {pymud-0.21.4.post4.dist-info → pymud-0.21.5.dist-info}/licenses/LICENSE.txt +0 -0
- {pymud-0.21.4.post4.dist-info → pymud-0.21.5.dist-info}/top_level.txt +0 -0
pymud/extras.py
CHANGED
@@ -502,7 +502,11 @@ class SessionSelectionState:
|
|
502
502
|
start_col: int = -1
|
503
503
|
end_col: int = -1
|
504
504
|
def is_valid(self):
|
505
|
-
return
|
505
|
+
return (self.start_row >= 0) and \
|
506
|
+
(self.start_col >= 0) and \
|
507
|
+
(self.end_row >= 0) and \
|
508
|
+
(self.end_col >= 0) and \
|
509
|
+
abs(self.start_row - self.end_row) + abs(self.start_col - self.end_col) > 0
|
506
510
|
|
507
511
|
@property
|
508
512
|
def rows(self):
|
@@ -622,6 +626,7 @@ class SessionBuffer(BufferBase):
|
|
622
626
|
if line.endswith(self.newline):
|
623
627
|
line = line.rstrip(self.newline)
|
624
628
|
newline_after_append = True
|
629
|
+
|
625
630
|
if not self.newline in line:
|
626
631
|
if self._isnewline:
|
627
632
|
self._lines.append(line)
|
@@ -655,6 +660,8 @@ class SessionBuffer(BufferBase):
|
|
655
660
|
self._lines.clear()
|
656
661
|
self.nosplit()
|
657
662
|
|
663
|
+
def forceNewline(self):
|
664
|
+
self._isnewline = True
|
658
665
|
|
659
666
|
@property
|
660
667
|
def lineCount(self):
|
@@ -709,9 +716,11 @@ class PyMudBufferControl(UIControl):
|
|
709
716
|
|
710
717
|
# 为MUD显示进行校正的处理,包括对齐校正,换行颜色校正等
|
711
718
|
self.FULL_BLOCKS = set("▂▃▅▆▇▄█━")
|
719
|
+
self.TABLE_LINES = set("┠┌└├┬┼┴╭╰─┨┘┐┤╮╯╔╚╠╦╪╩═╗╝╣┃││║")
|
712
720
|
self.SINGLE_LINES = set("┠┌└├┬┼┴╭╰─")
|
713
|
-
self.SINGLE_LINES_LEFT = set("
|
721
|
+
self.SINGLE_LINES_LEFT = set("┨┘┐┤╮╯")
|
714
722
|
self.DOUBLE_LINES = set("╔╚╠╦╪╩═")
|
723
|
+
self.DOUBLE_LINES_LEFT = set("╗╝╣")
|
715
724
|
self.ALL_COLOR_REGX = re.compile(r"(?:\[[\d;]+m)+")
|
716
725
|
self.AVAI_COLOR_REGX = re.compile(r"(?:\[[\d;]+m)+(?!$)")
|
717
726
|
self._color_start = ""
|
@@ -733,12 +742,11 @@ class PyMudBufferControl(UIControl):
|
|
733
742
|
"""
|
734
743
|
return False
|
735
744
|
|
736
|
-
|
737
745
|
def width_correction(self, line: str) -> str:
|
738
746
|
new_str = []
|
739
747
|
for idx, ch in enumerate(line):
|
740
|
-
|
741
748
|
if (east_asian_width(ch) in "FWA") and (wcwidth(ch) == 1):
|
749
|
+
|
742
750
|
if ch in self.FULL_BLOCKS:
|
743
751
|
new_str.append(ch)
|
744
752
|
new_str.append(ch)
|
@@ -751,12 +759,18 @@ class PyMudBufferControl(UIControl):
|
|
751
759
|
elif ch in self.SINGLE_LINES_LEFT:
|
752
760
|
new_str.append("─")
|
753
761
|
new_str.append(ch)
|
754
|
-
elif
|
755
|
-
new_str.append("
|
762
|
+
elif ch in self.DOUBLE_LINES_LEFT:
|
763
|
+
new_str.append("═")
|
756
764
|
new_str.append(ch)
|
757
765
|
else:
|
758
|
-
|
759
|
-
|
766
|
+
right = str.rstrip(line[idx+1:])
|
767
|
+
right_len = fragment_list_width(to_formatted_text(ANSI(right)))
|
768
|
+
if ((idx == len(line) - 1) or (right_len == 0)) and (ch in self.TABLE_LINES):
|
769
|
+
new_str.append(" ")
|
770
|
+
new_str.append(ch)
|
771
|
+
else:
|
772
|
+
new_str.append(ch)
|
773
|
+
new_str.append(' ')
|
760
774
|
else:
|
761
775
|
new_str.append(ch)
|
762
776
|
|
@@ -838,9 +852,14 @@ class PyMudBufferControl(UIControl):
|
|
838
852
|
|
839
853
|
# 其他校正
|
840
854
|
line = self.line_correction(line)
|
855
|
+
#line = self.return_correction(line)
|
841
856
|
|
842
857
|
# 处理ANSI标记(生成FormmatedText)
|
843
858
|
fragments = to_formatted_text(ANSI(line))
|
859
|
+
#fragments = explode_text_fragments(fragments)
|
860
|
+
|
861
|
+
# if Settings.client["beautify"]:
|
862
|
+
# fragments = self.fragment_correction(fragments)
|
844
863
|
|
845
864
|
# 选择内容标识
|
846
865
|
selected_fragment = " class:selected "
|
@@ -850,8 +869,10 @@ class PyMudBufferControl(UIControl):
|
|
850
869
|
|
851
870
|
if selection_at_line:
|
852
871
|
from_, to = selection_at_line
|
853
|
-
|
854
|
-
|
872
|
+
total_display = fragment_list_width(fragments)
|
873
|
+
if to == len(buffer.getLine(i)):
|
874
|
+
to = total_display
|
875
|
+
|
855
876
|
|
856
877
|
fragments = explode_text_fragments(fragments)
|
857
878
|
|
@@ -860,12 +881,14 @@ class PyMudBufferControl(UIControl):
|
|
860
881
|
# visualize the selection.
|
861
882
|
return [(selected_fragment, " ")]
|
862
883
|
else:
|
863
|
-
for i in range(from_, to):
|
884
|
+
for i in range(from_, min(to, total_display+1)):
|
864
885
|
if i < len(fragments):
|
865
886
|
old_fragment, old_text, *_ = fragments[i]
|
866
887
|
fragments[i] = (old_fragment + selected_fragment, old_text)
|
867
|
-
elif i == len(fragments):
|
868
|
-
|
888
|
+
# elif i == len(fragments):
|
889
|
+
# fragments.append((selected_fragment, " "))
|
890
|
+
|
891
|
+
|
869
892
|
|
870
893
|
return fragments
|
871
894
|
|
@@ -930,9 +953,8 @@ class PyMudBufferControl(UIControl):
|
|
930
953
|
buffer.selection.end_row = position.y
|
931
954
|
buffer.selection.end_col = position.x
|
932
955
|
|
933
|
-
|
934
|
-
|
935
|
-
|
956
|
+
if not buffer.selection.is_valid():
|
957
|
+
buffer.exit_selection()
|
936
958
|
|
937
959
|
# Select word around cursor on double click.
|
938
960
|
# Two MOUSE_UP events in a short timespan are considered a double click.
|
pymud/pymud.py
CHANGED
@@ -1084,12 +1084,8 @@ class PyMudApp:
|
|
1084
1084
|
"命令行回车按键处理"
|
1085
1085
|
cmd_line = buffer.text
|
1086
1086
|
space_index = cmd_line.find(" ")
|
1087
|
-
|
1088
|
-
if len(cmd_line)
|
1089
|
-
if self.current_session:
|
1090
|
-
self.current_session.writeline("")
|
1091
|
-
|
1092
|
-
elif cmd_line[0] != Settings.client["appcmdflag"]:
|
1087
|
+
|
1088
|
+
if (len(cmd_line) >= 1) and (cmd_line[0] != Settings.client["appcmdflag"]):
|
1093
1089
|
if self.current_session:
|
1094
1090
|
self.current_session.last_command = cmd_line
|
1095
1091
|
|
@@ -1101,6 +1097,7 @@ class PyMudApp:
|
|
1101
1097
|
if self.current_session:
|
1102
1098
|
if len(cmd_line) == 0:
|
1103
1099
|
self.current_session.writeline("")
|
1100
|
+
|
1104
1101
|
else:
|
1105
1102
|
try:
|
1106
1103
|
self.current_session.log.log(f"{Settings.gettext('msg_cmdline_input')} {cmd_line}\n")
|
pymud/session.py
CHANGED
@@ -810,6 +810,9 @@ class Session:
|
|
810
810
|
else:
|
811
811
|
if Settings.client["echo_input"]:
|
812
812
|
self.writetobuffer(f"\x1b[32m{line}\x1b[0m", True)
|
813
|
+
elif len(line) == 0:
|
814
|
+
# 当向服务器仅送出空行时,本地强制后续显示换行
|
815
|
+
self.buffer.forceNewline()
|
813
816
|
else:
|
814
817
|
self.log.log(f"\x1b[32m{line}\x1b[0m\n")
|
815
818
|
|
pymud/settings.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pymud
|
3
|
-
Version: 0.21.
|
3
|
+
Version: 0.21.5
|
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,6 +66,12 @@ Dynamic: license-file
|
|
66
66
|
|
67
67
|
## 版本更新信息
|
68
68
|
|
69
|
+
### 0.21.5 (2025-06-09)
|
70
|
+
|
71
|
+
+ 功能完善: 完善了美化功能,已知情况下,应该不会出现断行和不对齐问题了。
|
72
|
+
+ 功能完善: 向服务器仅送出回车符号时,本地显示也强制换行。在出现『未完待续』情况时,回车后不会再跟在后面显示了,而是会强制从下一行开始。
|
73
|
+
+ 功能完善: 当对行进行双击选择时,背景增加的选择标记(灰色)会按照实际显示的宽度进行匹配,而不是按照原始数据的宽度进行匹配。
|
74
|
+
|
69
75
|
### 0.21.4 (2025-06-08)
|
70
76
|
|
71
77
|
+ 问题修复: 修复了在多行选择碰到空行时,会导致从头开始全选的问题。
|
@@ -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=rNuDaKk65Cwc9K6t0-BpqNUORs8-8X5Xsv6YaLQ7hc4,9839
|
4
4
|
pymud/dialogs.py,sha256=1xo5NJjch-u7RSRcclhvUE4gi8POgiZWK84lNx_HJbs,6891
|
5
|
-
pymud/extras.py,sha256
|
5
|
+
pymud/extras.py,sha256=iadkEIIiRoFjRX8ezMxK3Dud6wuVf14ZbluXC0hfmuU,38284
|
6
6
|
pymud/i18n.py,sha256=qLgvrmYhVfkTHKpbBR-LfYMOrGgi0skHrelbsj7ItbE,3034
|
7
7
|
pymud/logger.py,sha256=F2LBUogdzv2WXHo10CNorDh2VleAX1Wbwmxc3zznHlM,5823
|
8
8
|
pymud/main.py,sha256=zaSjNhpbX3FMulKg-UNFrdiIJO8sOmmrUQrkPOalB-4,10224
|
@@ -10,14 +10,14 @@ pymud/modules.py,sha256=CsOqY1c59CrejltCS4wf7QqdCr5k_ghel8AUqlKVGIw,11873
|
|
10
10
|
pymud/objects.py,sha256=NlKAQnV6v9lSkz94zmgb513HPxskY8-tXnOdrYhuktc,38629
|
11
11
|
pymud/pkuxkx.py,sha256=qDVry-Vd6MNui0NKWZFT52IpmP1sKS5Dz74EDY4tVGQ,14740
|
12
12
|
pymud/protocol.py,sha256=noptJs6K0L9qM8VZIeP65H4k9FPLGJqxvm3qY2iAwvI,48315
|
13
|
-
pymud/pymud.py,sha256=
|
14
|
-
pymud/session.py,sha256=
|
15
|
-
pymud/settings.py,sha256=
|
13
|
+
pymud/pymud.py,sha256=K1tTKlkE6y3oZDsP2t6iN5XNMQ1R_QE2um1JgI8THRg,53381
|
14
|
+
pymud/session.py,sha256=_ReMajT7uhTmyOppnUd9VScSFe6Hbl_smEaOD_hXJxc,154851
|
15
|
+
pymud/settings.py,sha256=YE-RWG-TRD92gIXsVrwY0VOCvjudl-68naFcgOfCJ7I,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.
|
19
|
-
pymud-0.21.
|
20
|
-
pymud-0.21.
|
21
|
-
pymud-0.21.
|
22
|
-
pymud-0.21.
|
23
|
-
pymud-0.21.
|
18
|
+
pymud-0.21.5.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
19
|
+
pymud-0.21.5.dist-info/METADATA,sha256=YawLwvGN7CGEHNvmX5VGL3ADyDDiTHyze67MW-ySDXM,47052
|
20
|
+
pymud-0.21.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
21
|
+
pymud-0.21.5.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
|
22
|
+
pymud-0.21.5.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
|
23
|
+
pymud-0.21.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|