> On Mar 17, 2025, at 5:02 PM, Jean Lalonde <
jlalo...@gmail.com> wrote:
>
> Thank you for your help Mitchell.
>
> Here is a sample of my AutoHotkey code. The function SetEditorText() gets the current vertical position, replace the editor with the new text and tries to restore the vertical position.
>
> ;---------------------------------------------------------
> SetEditorText(strNewText, intStart, intEnd)
> ;---------------------------------------------------------
> {
> ; o_Sci is an AutoHotkey class wrapper for Scintilla commands messages
>
> intFirstVisibleLine := o_Sci.GETFIRSTVISIBLELINE()
> intDocLineFromVisible := o_Sci.DOCLINEFROMVISIBLE(intFirstVisibleLine)
>
> o_Sci.SETTEXT("", strNewText, 1)
>
> o_Sci.SETSEL(intStart, intEnd)
> o_Sci.VISIBLEFROMDOCLINE(intDocLineFromVisible)
I think you need `o_Sci.SETFIRSTVISIBLELINE(o_Sci.VISIBLEFROMDOCLINE(intDocLineFromVisible))`
In my last response, what I meant by “restore with VISIBLEFROMDOCLINE” was to pass the result to SETFIRSTVISIBLELINE. Sorry that wasn’t more clear.