console-window 1.4.2__tar.gz → 1.4.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: console-window
3
- Version: 1.4.2
3
+ Version: 1.4.3
4
4
  Summary: A robust curses wrapper for creating Text User Interfaces (TUIs).
5
5
  Author-email: Joe Defen <joedef@duck.com>
6
6
  Requires-Python: >=3.8
@@ -492,6 +492,7 @@ class InlineConfirmation:
492
492
  - 'yes'/'YES': Explicit string confirmation (case-sensitive for 'YES').
493
493
  - 'identity': Requires typing a specific string (e.g., a device node like 'sda1').
494
494
  - 'choices': Flexible matching against a list of valid strings.
495
+ - 'text': Free-form text input - accepts any text and confirms on ENTER.
495
496
 
496
497
  :param min_abbrev_chars: Minimum characters required for abbreviated choice matching.
497
498
  When None (default), automatically calculates based on choices:
@@ -501,7 +502,7 @@ class InlineConfirmation:
501
502
  Methods:
502
503
  - get_hint(): Returns a hint string when input_buffer is empty (display in dimmed/italic style)
503
504
  """
504
- MODES = 'Y y YES yes identity choices'.split()
505
+ MODES = 'Y y YES yes identity choices text'.split()
505
506
 
506
507
  def __init__(self, min_abbrev_chars=None):
507
508
  self.active = False
@@ -629,7 +630,11 @@ class InlineConfirmation:
629
630
  self.input_buffer = self.input_buffer[:-1]
630
631
  elif key in (10, 13): # Enter
631
632
  match = None
632
-
633
+
634
+ # 'text' mode: accept any input
635
+ if self.mode == 'text':
636
+ return 'confirmed' if self.input_buffer else 'continue'
637
+
633
638
  if self.mode == 'choices':
634
639
  match = self._resolve_choice()
635
640
  elif self.mode == 'identity':
@@ -638,11 +643,11 @@ class InlineConfirmation:
638
643
  if self.input_buffer == 'YES': match = 'YES'
639
644
  else: # 'yes' or other permissive modes
640
645
  if self.input_buffer.lower() == 'yes': match = self.input_buffer
641
-
646
+
642
647
  if match:
643
648
  self.input_buffer = match # Canonicalize
644
649
  return 'confirmed'
645
-
650
+
646
651
  self.input_buffer = '' # Reset on failure
647
652
 
648
653
  return 'continue'
@@ -663,6 +668,8 @@ class InlineConfirmation:
663
668
  return 'Type yes + ENTER or ESC'
664
669
  elif self.mode == 'identity':
665
670
  return f'Type {self.identity} + ENTER or ESC'
671
+ elif self.mode == 'text':
672
+ return 'Type text + ENTER or ESC'
666
673
  elif self.mode == 'choices':
667
674
  if len(self.choices) == 1:
668
675
  return f'Type {self.choices[0]} + ENTER or ESC'
@@ -23,7 +23,7 @@ name = "console_window"
23
23
  # UNIFIED PROJECT METADATA (Replaces [tool.flit.metadata])
24
24
  [project]
25
25
  name = "console-window"
26
- version = "1.4.2"
26
+ version = "1.4.3"
27
27
  description = "A robust curses wrapper for creating Text User Interfaces (TUIs)."
28
28
  readme = "README.md"
29
29
  requires-python = ">=3.8"
File without changes
File without changes