The tostring() comparison fix wasn't sufficient - jump-to-end was still
firing on nearly every incoming line while jump-to-end-on-focus was on.
AppendToNotepad's own SetSel/ReplaceSel appears to momentarily perturb
GetFocus() around each append, which poll_output_focus was reading as a
genuine "just switched to the window" edge. Now skips the jump if a
SmartAppendToNotepad call happened within the last 0.5s.
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.
- output_functions.xml: merge NotepadSmartScroll's Win32/Alien-based
smart-scroll logic in directly (was a separate plugin). Fixed the
caret-restore bug: gating the restore on scroll position was wrong
since the notepad tracks near the bottom during normal reading; now
gated on whether the caret was literally at the end of the old text.
Added a jump-to-end-on-focus toggle (Ctrl+Alt+J) with a 0.2s polling
timer to catch focus landing on the output notepad by any means.
- Reverted the Tab/Ctrl+Space rebinding - removed switch_to_output and
trigger_word_completion along with their accelerators.
- cosmic rage.MCL: dropped the dangling NotepadSmartScroll.xml include
(file no longer exists, was reintroduced by an auto-save).
- readme.md: documented the actual current CosmicRage.xml keys (several
had drifted out of sync - Alt+F12 is now stop-sounds not restart,
Alt+Delete/Ctrl+S/Ctrl+F1-3/Alt+F3/Alt+Shift+H/F11 were undocumented)
and added the output_functions.xml accessible-output keybindings,
which weren't documented at all before.