Fixed character navigation in table mode.
This commit is contained in:
@ -361,6 +361,27 @@ class TableManager:
|
||||
column_pos = line_text.find(target_text, search_start)
|
||||
return column_pos if column_pos != -1 else search_start
|
||||
|
||||
def is_cursor_within_current_cell(self, cursor_x, cursor_y):
|
||||
"""Check if the given cursor position is within the current table cell"""
|
||||
if not self.is_table_mode():
|
||||
return False
|
||||
|
||||
line_text = self.env["runtime"]["ScreenManager"].get_line_text(cursor_y)
|
||||
if not line_text:
|
||||
return False
|
||||
|
||||
columns = self.parse_line_into_columns(line_text)
|
||||
if not columns or self.currentColumn < 0 or self.currentColumn >= len(columns):
|
||||
return False
|
||||
|
||||
# Get the bounds of the current column
|
||||
column_start = self.get_column_start_position(line_text, self.currentColumn)
|
||||
column_text = columns[self.currentColumn]
|
||||
column_end = column_start + len(column_text)
|
||||
|
||||
# Check if cursor is within the column bounds
|
||||
return column_start <= cursor_x < column_end
|
||||
|
||||
def reset_table_mode(self):
|
||||
self.set_head_line()
|
||||
|
||||
|
Reference in New Issue
Block a user