pymud 0.21.4.post2__py3-none-any.whl → 0.21.4.post4__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
@@ -271,7 +271,7 @@ class VSplitWindow(Window):
271
271
  # 复制上半部分,正序复制,确保即使有自动折行时,第一行也保持在屏幕最顶部
272
272
  y = -vertical_scroll_2
273
273
  lineno = start_lineno
274
- while y < below and lineno < line_count:
274
+ while y <= upper and lineno < line_count:
275
275
  line = ui_content.get_line(lineno)
276
276
  visible_line_to_row_col[y] = (lineno, horizontal_scroll)
277
277
  x = 0
@@ -358,7 +358,7 @@ class VSplitWindow(Window):
358
358
  if not b:
359
359
  return
360
360
  start_lineno = b.start_lineno
361
- if (start_lineno >= 0) and (start_lineno < b.lineCount - (len(info.displayed_lines) - 1) // 2):
361
+ if (start_lineno >= 0) and (start_lineno < b.lineCount - (info.window_height - 1) // 2):
362
362
  b.start_lineno = b.start_lineno + 1
363
363
  else:
364
364
  b.start_lineno = -1
@@ -381,9 +381,8 @@ class VSplitWindow(Window):
381
381
  elif start_lineno == 0:
382
382
  b.start_lineno = 0
383
383
 
384
- else:
385
- b.start_lineno = b.lineCount - (len(info.displayed_lines) - 1) // 2
386
-
384
+ elif b.start_lineno < 0 and b.lineCount >= info.window_height:
385
+ b.start_lineno = b.lineCount - (info.window_height - 1) // 2
387
386
 
388
387
 
389
388
  class EasternButton(Button):
@@ -503,21 +502,7 @@ class SessionSelectionState:
503
502
  start_col: int = -1
504
503
  end_col: int = -1
505
504
  def is_valid(self):
506
- if self.start_row >= 0 and self.end_row >= 0 and self.start_col >= 0 and self.end_col >= 0:
507
- if (self.start_row == self.end_row) and (self.start_col == self.end_col):
508
- return False
509
- # elif self.start_row > self.end_row:
510
- # srow, scol = self.end_row, self.end_col
511
- # erow, ecol = self.start_row, self.start_col
512
- # self.start_row, self.end_row = srow, erow
513
- # self.start_col, self.end_col = scol, ecol
514
- # elif self.start_row == self.end_row and self.start_col > self.end_col:
515
- # scol, ecol = self.end_col, self.start_col
516
- # self.start_col, self.end_col = scol, ecol
517
-
518
- return True
519
-
520
- return False
505
+ return abs(self.start_row - self.end_row) + abs(self.start_col - self.end_col) > 0
521
506
 
522
507
  @property
523
508
  def rows(self):
@@ -654,7 +639,7 @@ class SessionBuffer(BufferBase):
654
639
  self._isnewline = newline_after_append
655
640
 
656
641
  ## limit buffered lines
657
- if len(self._lines) > self.max_buffered_lines:
642
+ if self.start_lineno < 0 and len(self._lines) > self.max_buffered_lines:
658
643
  diff = len(self._lines) - self.max_buffered_lines
659
644
  del self._lines[:diff]
660
645
  ## adjust selection
@@ -665,10 +650,11 @@ class SessionBuffer(BufferBase):
665
650
  get_app().invalidate()
666
651
 
667
652
  def clear(self):
653
+ self.exit_selection()
654
+ self._isnewline = True
668
655
  self._lines.clear()
669
- self.selection = SessionSelectionState(-1, -1, -1, -1)
656
+ self.nosplit()
670
657
 
671
- get_app().invalidate()
672
658
 
673
659
  @property
674
660
  def lineCount(self):
@@ -722,7 +708,7 @@ class PyMudBufferControl(UIControl):
722
708
  self.buffer = buffer
723
709
 
724
710
  # 为MUD显示进行校正的处理,包括对齐校正,换行颜色校正等
725
- self.FULL_BLOCKS = set("▂▃▅▆▇▄█━◇◆")
711
+ self.FULL_BLOCKS = set("▂▃▅▆▇▄█━")
726
712
  self.SINGLE_LINES = set("┠┌└├┬┼┴╭╰─")
727
713
  self.SINGLE_LINES_LEFT = set("┨┘┐┤")
728
714
  self.DOUBLE_LINES = set("╔╚╠╦╪╩═")
@@ -753,7 +739,6 @@ class PyMudBufferControl(UIControl):
753
739
  for idx, ch in enumerate(line):
754
740
 
755
741
  if (east_asian_width(ch) in "FWA") and (wcwidth(ch) == 1):
756
-
757
742
  if ch in self.FULL_BLOCKS:
758
743
  new_str.append(ch)
759
744
  new_str.append(ch)
@@ -802,7 +787,7 @@ class PyMudBufferControl(UIControl):
802
787
  # 处理Tab(\r)符号(^I)对齐
803
788
  line = self.tab_correction(line)
804
789
 
805
- line += "\u200B" # 最后添加一个不可见字符,用于允许选择行时选到最后一个字符
790
+ line += " " # 最后添加一个空格,用于允许选择行时选到最后一个字符
806
791
 
807
792
  return line
808
793
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymud
3
- Version: 0.21.4.post2
3
+ Version: 0.21.4.post4
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>
@@ -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=hanyH3_mTagZplG72ENBcqGz-QaSD0EBR2rA8be15Ts,37944
5
+ pymud/extras.py,sha256=-rpiNCxDshb4tEN0a3W1DVWLWlkIhapoHZpsEFjeQoI,37300
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
@@ -15,9 +15,9 @@ pymud/session.py,sha256=sTswAPEl5GWcxzYmgovG8lOlflNTd5k8ggW6zJ6vcMY,154690
15
15
  pymud/settings.py,sha256=V4wHKP2UjmX_l2bKJoUJSfNbH7vs3GZlN4u-1tRFbxA,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.4.post2.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
19
- pymud-0.21.4.post2.dist-info/METADATA,sha256=4B4ve7Q2LXY5wMzmmPbge1sGxYlBq-fFRI8uu4LUPXg,46537
20
- pymud-0.21.4.post2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- pymud-0.21.4.post2.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
22
- pymud-0.21.4.post2.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
23
- pymud-0.21.4.post2.dist-info/RECORD,,
18
+ pymud-0.21.4.post4.dist-info/licenses/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
19
+ pymud-0.21.4.post4.dist-info/METADATA,sha256=gJWAlyqUnFxb1mtHbjXl30Zd5LSuAAtUDKvUy_LVSjg,46537
20
+ pymud-0.21.4.post4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ pymud-0.21.4.post4.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
22
+ pymud-0.21.4.post4.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
23
+ pymud-0.21.4.post4.dist-info/RECORD,,