Fix Accelerator function-call bindings and jump-to-end false triggers
Accelerator(key, text) always sends text as a literal typed command - it only calls a Lua function if a matching <alias> routes it there (the pattern GagManager already used correctly). Several bindings added this session skipped that step and were silently sending gibberish to the MUD instead of running: Ctrl+S (save_state_func) in CosmicRage.xml, Ctrl+Alt+J (toggle_jump_to_end) in output_functions.xml, and Alt+Enter (toggle_numpad) in NumpadMovement.xml. Added the missing aliases for all three. Separately, poll_output_focus's jump-to-end was firing repeatedly even while focus never changed: it compared Alien pointer returns with "==", which is unreliable for Alien's userdata-wrapped pointers (two separate calls returning the same real HWND don't reliably compare equal). Switched to comparing tostring() output instead, which is address-based. Debug log confirmed SmartAppendToNotepad's own restore logic was correct throughout - this poll was the sole cause of the "jumps to end when new text arrives" complaint.
This commit is contained in:
@@ -392,6 +392,17 @@ match="^\$sphook\s+(?P<action>[\w]+):(?P<path>[-\w./\\\s]+):(?P<volume>[\w]+):(?
|
||||
|
||||
|
||||
<aliases>
|
||||
<alias
|
||||
match="save_state_func"
|
||||
enabled="y"
|
||||
script="save_state_func"
|
||||
omit_from_output="y"
|
||||
omit_from_log="y"
|
||||
omit_from_command_history="y"
|
||||
send_to="12"
|
||||
sequence="100"
|
||||
>
|
||||
</alias>
|
||||
<alias
|
||||
match="f11_stop"
|
||||
enabled="y"
|
||||
|
||||
@@ -10,10 +10,25 @@
|
||||
language="Lua"
|
||||
purpose="Toggleable numpad movement, with Ctrl for up-movement and Ctrl+Alt for down-movement."
|
||||
requires="4.82"
|
||||
version="1.0"
|
||||
version="1.1"
|
||||
>
|
||||
</plugin>
|
||||
|
||||
<!-- Aliases -->
|
||||
<aliases>
|
||||
<alias
|
||||
match="toggle_numpad"
|
||||
enabled="y"
|
||||
script="toggle_numpad"
|
||||
omit_from_output="y"
|
||||
omit_from_log="y"
|
||||
omit_from_command_history="y"
|
||||
send_to="12"
|
||||
sequence="100"
|
||||
>
|
||||
</alias>
|
||||
</aliases>
|
||||
|
||||
<!-- Script -->
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
||||
@@ -170,6 +170,17 @@ omit_from_command_history="y"
|
||||
send_to="12"
|
||||
sequence="100">
|
||||
</alias>
|
||||
|
||||
<alias
|
||||
match="toggle_jump_to_end"
|
||||
enabled="y"
|
||||
script="toggle_jump_to_end"
|
||||
omit_from_output="y"
|
||||
omit_from_log="y"
|
||||
omit_from_command_history="y"
|
||||
send_to="12"
|
||||
sequence="100">
|
||||
</alias>
|
||||
</aliases>
|
||||
|
||||
<!-- Timers -->
|
||||
@@ -457,7 +468,12 @@ function poll_output_focus()
|
||||
return
|
||||
end
|
||||
local focused = GetFocus()
|
||||
local is_focused = (focused == edit)
|
||||
-- Compare by string representation, not raw "==": Alien's pointer
|
||||
-- returns are full userdata objects, so two separate calls returning
|
||||
-- the same real HWND don't reliably compare equal with "==" (which
|
||||
-- fell back to identity comparison), causing spurious "just gained
|
||||
-- focus" edges and repeated jump-to-end even while focus never moved.
|
||||
local is_focused = (tostring(focused) == tostring(edit))
|
||||
if is_focused and not was_output_focused then
|
||||
jump_notepad_to_end(edit)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user