Skip to content

Commit 3b27181

Browse files
committed
Remove argument
1 parent f07eefd commit 3b27181

File tree

10 files changed

+22
-74
lines changed

10 files changed

+22
-74
lines changed

.config/pydoclint-baseline.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ src/ansible_navigator/ui_framework/ui.py
333333
--------------------
334334
src/ansible_navigator/ui_framework/ui_config.py
335335
DOC601: Class `UIConfig`: Class docstring contains fewer class attributes than actual class attributes. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
336+
DOC603: Class `UIConfig`: Class docstring attributes are different from actual class attributes. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Attributes in the class definition but not in the docstring: [color: bool, colors_initialized: bool, grammar_dir: Traversable, osc4: bool, terminal_colors_path: Traversable, theme_path: Traversable]. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
336337
--------------------
337338
src/ansible_navigator/ui_framework/ui_constants.py
338339
DOC601: Class `Color`: Class docstring contains fewer class attributes than actual class attributes. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)

src/ansible_navigator/action_runner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def initialize_ui(self, refresh: int) -> None:
6767
osc4=self._args.osc4,
6868
terminal_colors_path=TERMINAL_COLORS_PATH,
6969
theme_path=THEME_PATH,
70-
cursor_navigation=bool(getattr(self._args, "cursor_navigation", False)),
7170
)
7271
self._logger.debug("grammar path = %s", config.grammar_dir)
7372
self._logger.debug("theme path = %s", config.theme_path)

src/ansible_navigator/configuration_subsystem/navigator_configuration.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,6 @@ class Internals:
316316
value=SettingsEntryValue(),
317317
version_added="v2.0",
318318
),
319-
SettingsEntry(
320-
name="cursor_navigation",
321-
choices=[True, False],
322-
cli_parameters=CliParameters(short="--cn", action="store_true"),
323-
settings_file_path_override="ui.cursor-navigation",
324-
short_description="Enable arrow-key cursor navigation and Enter selection in menus",
325-
value=SettingsEntryValue(default=False),
326-
version_added="v2.5",
327-
),
328319
SettingsEntry(
329320
name="display_color",
330321
change_after_initial=False,

src/ansible_navigator/data/ansible-navigator.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -518,29 +518,14 @@
518518
"default": "UTC",
519519
"description": "Specify the IANA time zone to use or 'local' to use the system time zone",
520520
"type": "string"
521-
},
522-
"ui": {
523-
"additionalProperties": false,
524-
"properties": {
525-
"cursor-navigation": {
526-
"default": false,
527-
"description": "Enable arrow-key cursor navigation and Enter selection in menus",
528-
"enum": [
529-
true,
530-
false
531-
],
532-
"type": "boolean"
533-
}
534-
},
535-
"type": "object"
536521
}
537522
}
538523
}
539524
},
540525
"required": [
541526
"ansible-navigator"
542527
],
543-
"title": "ansible-navigator settings v24",
528+
"title": "ansible-navigator settings v25",
544529
"type": "object",
545-
"version": "24"
530+
"version": "25"
546531
}

src/ansible_navigator/data/settings-sample.template.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ ansible-navigator:
6363
enable: True
6464
# {{ color.osc4 }}
6565
osc4: True
66-
ui:
67-
# {{ ui.cursor-navigation }}
68-
cursor-navigation: False
6966
editor:
7067
# {{ editor.command }}
7168
command: vim_from_setting

src/ansible_navigator/data/settings-schema.partial.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,6 @@
284284
"time-zone": {
285285
"type": "string"
286286
},
287-
"ui": {
288-
"additionalProperties": false,
289-
"properties": {
290-
"cursor-navigation": {
291-
"type": "boolean"
292-
}
293-
},
294-
"type": "object"
295-
},
296287
"settings": {
297288
"additionalProperties": false,
298289
"properties": {

src/ansible_navigator/ui_framework/ui.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ def __init__(
201201
self._screen.timeout(refresh)
202202
self._screen.keypad(True) # Enable keypad mode for proper key handling
203203
self._one_line_input = FormHandlerText(screen=self._screen, ui_config=self._ui_config)
204-
# When cursor navigation is enabled, this tracks which visible row to highlight
204+
# This tracks which visible row to highlight
205205
self._highlight_line_offset: int | None = None
206-
# When cursor navigation is enabled, this tracks the cursor position in menus
206+
# This tracks the cursor position in menus
207207
self._menu_cursor_pos: int = 0
208208

209209
def clear(self) -> None:
@@ -484,9 +484,9 @@ def _display(
484484
line_index = line_numbers[idx]
485485
line_index_str = str(line_index).rjust(index_width)
486486
prefix = f"{line_index_str}\u2502"
487-
# Apply highlight decoration when enabled and this is the selected row
488-
if (indent_heading and self._ui_config.cursor_navigation and
489-
self._highlight_line_offset is not None and idx == self._highlight_line_offset):
487+
# Apply highlight decoration when this is the selected row
488+
if (indent_heading and self._highlight_line_offset is not None and
489+
idx == self._highlight_line_offset):
490490
# Rebuild the line with reverse-video decoration added
491491
highlighted_parts = tuple(
492492
CursesLinePart(
@@ -526,11 +526,9 @@ def _display(
526526
char = self._screen.getch()
527527
key = "KEY_F(5)" if char == -1 else curses.keyname(char).decode()
528528
# Debug: log the raw char and converted key for troubleshooting
529-
if self._ui_config.cursor_navigation:
530-
self._logger.debug("Raw char: %s, Converted key: '%s'", char, key)
529+
self._logger.debug("Raw char: %s, Converted key: '%s'", char, key)
531530
# Check for Enter key codes and return a special value for cursor navigation
532-
if (self._ui_config.cursor_navigation and
533-
char in [10, 13]): # Enter key codes: 10=LF, 13=CR
531+
if char in [10, 13]: # Enter key codes: 10=LF, 13=CR
534532
self._logger.debug(
535533
"Enter key detected! Raw char: %s, setting key to CURSOR_ENTER", char
536534
)
@@ -948,7 +946,7 @@ def _show_menu(
948946

949947
# Determine which row to highlight, if enabled
950948
self._highlight_line_offset = None
951-
if self._ui_config.cursor_navigation and self._menu_indices:
949+
if self._menu_indices:
952950
self._menu_cursor_pos = max(0, min(self._menu_cursor_pos,
953951
len(self._menu_indices) - 1))
954952
selected_global_index = self._menu_indices[self._menu_cursor_pos]
@@ -968,13 +966,11 @@ def _show_menu(
968966
)
969967

970968
# Debug: log what entry we received
971-
if self._ui_config.cursor_navigation:
972-
self._logger.debug("Received entry: '%s'", entry)
969+
self._logger.debug("Received entry: '%s'", entry)
973970

974971
# Handle arrow navigation for menus when enabled
975972
if entry in ["KEY_RESIZE", "KEY_DOWN", "KEY_UP", "KEY_NPAGE", "KEY_PPAGE", "^F", "^B"]:
976-
if (entry in ["KEY_DOWN", "KEY_UP"] and self._ui_config.cursor_navigation and
977-
self._menu_indices):
973+
if (entry in ["KEY_DOWN", "KEY_UP"] and self._menu_indices):
978974
# Move the cursor position
979975
if entry == "KEY_DOWN" and self._menu_cursor_pos < len(self._menu_indices) - 1:
980976
self._menu_cursor_pos += 1
@@ -997,8 +993,7 @@ def _show_menu(
997993
continue
998994

999995
# Enter key should select the highlighted item when cursor nav is enabled
1000-
if (self._ui_config.cursor_navigation and
1001-
(entry == "CURSOR_ENTER" or entry in ["^J", "^M", "KEY_ENTER", "KEY_RETURN"]) and
996+
if ((entry == "CURSOR_ENTER" or entry in ["^J", "^M", "KEY_ENTER", "KEY_RETURN"]) and
1002997
self._menu_indices):
1003998
self._logger.debug("Enter key selection triggered! Entry: '%s', Selecting index %s",
1004999
entry, self._menu_cursor_pos)

src/ansible_navigator/ui_framework/ui_config.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,22 @@
77

88
@dataclass
99
class UIConfig:
10-
"""The UI configuration.
10+
"""Object to hold basic UI settings.
1111
12-
Args:
13-
color: Enable the use of color for mode interactive and stdout
14-
colors_initialized: Whether colors have been initialized
15-
cursor_navigation: Enable arrow-key cursor navigation and Enter selection in menus
16-
grammar_dir: The path to the grammar directory
17-
osc4: Enable or disable terminal color changing support with OSC 4
18-
terminal_colors_path: The path to the terminal colors file
19-
theme_path: The path to the theme file
12+
Used to determine properties about rendering things. An instance of this
13+
class gets threaded throughout most of the UI system, so it can be used for
14+
fairly global things, such as "should we render color, ever?"
2015
"""
2116

22-
#: Enable the use of color for mode interactive and stdout
17+
#: Indicates coloring is enabled or disabled
2318
color: bool
24-
#: Whether colors have been initialized
19+
#: Indicates if the curses colors have been initialized
2520
colors_initialized: bool
2621
#: The path to the grammar directory
2722
grammar_dir: Traversable
28-
#: Enable or disable terminal color changing support with OSC 4
23+
#: Indicates if terminal support for OSC4 is enabled
2924
osc4: bool
30-
#: The path to the terminal colors file
25+
#: The path to the 16 terminal color map
3126
terminal_colors_path: Traversable
3227
#: The path to the theme file
3328
theme_path: Traversable
34-
#: Enable arrow-key cursor navigation and Enter selection in menus
35-
cursor_navigation: bool = False

tests/fixtures/unit/configuration_subsystem/ansible-navigator.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ ansible-navigator:
3434
color:
3535
enable: False
3636
osc4: False
37-
ui:
38-
cursor-navigation: true
3937
editor:
4038
command: vim_from_setting
4139
console: False

tests/unit/configuration_subsystem/data.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def d2t(dictionary: dict[Any, Any]) -> tuple[Any, ...]:
7575
"ansible_runner_timeout": 300,
7676
"container_engine": "docker",
7777
"container_options": ["--net=host"],
78-
"cursor_navigation": True,
7978
"display_color": False,
8079
"editor_command": "vim_base",
8180
"editor_console": True,
@@ -237,7 +236,6 @@ def cli_data() -> Generator[ParameterSet, None, None]:
237236
pytest.param("config", "/tmp/ansible.cfg", "/tmp/ansible.cfg", id="7"),
238237
pytest.param("container_engine", "docker", "docker", id="8"),
239238
pytest.param("container_options", "--net=host", ["--net=host"], id="9"),
240-
pytest.param("cursor_navigation", "true", True, id="9a"),
241239
pytest.param("display_color", "yellow is the color of a banana", False, id="10"),
242240
pytest.param("editor_command", "nano_env_var", "nano_env_var", id="11"),
243241
pytest.param("editor_console", "false", False, id="12"),

0 commit comments

Comments
 (0)