Re: Restoring the vertical position

Mitchell <[email protected]> Mon, 17 Mar 2025 17:54:12 -0400
Newsgroups gmane.comp.lib.scintilla.devel
Message-ID <[email protected]>
Hi,

> On Mar 17, 2025, at 5:02 PM, Jean Lalonde <[email protected]> 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.

Cheers,
Mitchell

-- 
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/4A76C2A2-CF7E-4D09-A349-1A9A277B5406%40foicica.com.