Multiple fixes to indentation beep code, including volume for lower ranged beeps using the gstreamer driver.
This commit is contained in:
@@ -60,9 +60,10 @@ class command:
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_int(
|
||||
"general", "autoPresentIndentMode"
|
||||
) in [0, 1]:
|
||||
self.env["runtime"]["OutputManager"].play_frequence(
|
||||
curr_ident * 50, 0.1, interrupt=do_interrupt
|
||||
)
|
||||
if self.lastIdent != curr_ident:
|
||||
self.env["runtime"]["OutputManager"].play_frequence(
|
||||
curr_ident * 50, 0.1, interrupt=do_interrupt
|
||||
)
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_int(
|
||||
"general", "autoPresentIndentMode"
|
||||
) in [0, 2]:
|
||||
|
@@ -31,10 +31,9 @@ class command:
|
||||
self.lastIdent = 0
|
||||
return
|
||||
|
||||
# is a vertical change?
|
||||
if not self.env["runtime"][
|
||||
"CursorManager"
|
||||
].is_cursor_horizontal_move():
|
||||
# Skip if no cursor movement at all
|
||||
if (not self.env["runtime"]["CursorManager"].is_cursor_horizontal_move() and
|
||||
not self.env["runtime"]["CursorManager"].is_cursor_vertical_move()):
|
||||
return
|
||||
x, y, curr_line = line_utils.get_current_line(
|
||||
self.env["screen"]["new_cursor"]["x"],
|
||||
@@ -43,27 +42,34 @@ class command:
|
||||
)
|
||||
curr_ident = self.env["screen"]["new_cursor"]["x"]
|
||||
|
||||
if not curr_line.isspace():
|
||||
# ident
|
||||
lastIdent, lastY, last_line = line_utils.get_current_line(
|
||||
self.env["screen"]["new_cursor"]["x"],
|
||||
self.env["screen"]["new_cursor"]["y"],
|
||||
self.env["screen"]["old_content_text"],
|
||||
)
|
||||
if curr_line.strip() != last_line.strip():
|
||||
return
|
||||
if len(curr_line.lstrip()) == len(last_line.lstrip()):
|
||||
return
|
||||
if curr_line.isspace():
|
||||
# Don't beep for lines with only spaces - no meaningful indentation
|
||||
return
|
||||
|
||||
# Lines with actual content - calculate proper indentation
|
||||
lastIdent, lastY, last_line = line_utils.get_current_line(
|
||||
self.env["screen"]["new_cursor"]["x"],
|
||||
self.env["screen"]["new_cursor"]["y"],
|
||||
self.env["screen"]["old_content_text"],
|
||||
)
|
||||
if curr_line.strip() != last_line.strip():
|
||||
return
|
||||
if len(curr_line.lstrip()) == len(last_line.lstrip()):
|
||||
return
|
||||
|
||||
curr_ident = len(curr_line) - len(curr_line.lstrip())
|
||||
curr_ident = len(curr_line) - len(curr_line.lstrip())
|
||||
|
||||
if self.lastIdent == -1:
|
||||
self.lastIdent = curr_ident
|
||||
if curr_ident <= 0:
|
||||
return
|
||||
if curr_ident <= 0:
|
||||
return
|
||||
|
||||
# Initialize lastIdent if needed
|
||||
if self.lastIdent == -1:
|
||||
self.lastIdent = curr_ident
|
||||
|
||||
# Only beep/announce if indentation level has changed
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"general", "autoPresentIndent"
|
||||
):
|
||||
) and self.lastIdent != curr_ident:
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_int(
|
||||
"general", "autoPresentIndentMode"
|
||||
) in [0, 1]:
|
||||
@@ -71,14 +77,15 @@ class command:
|
||||
curr_ident * 50, 0.1, interrupt=False
|
||||
)
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_int(
|
||||
"general", "autoPresentIndentMode"
|
||||
"general", "autePresentIndentMode"
|
||||
) in [0, 2]:
|
||||
if self.lastIdent != curr_ident:
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("indented ") + str(curr_ident) + " ",
|
||||
interrupt=False,
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("indented ") + str(curr_ident) + " ",
|
||||
interrupt=False,
|
||||
flush=False,
|
||||
)
|
||||
|
||||
# Always update lastIdent for next comparison
|
||||
self.lastIdent = curr_ident
|
||||
|
||||
def set_callback(self, callback):
|
||||
|
Reference in New Issue
Block a user