I found that to position to a particular line you first move to the bottom then reposition to the character count of the line. That puts the line at the top of the window. If the position is above when you reposition it puts the line at the bottom. And, of course, if the requested position is too close to the top or bottom of the script, the selected line appears somewhere in the middle.
But the interesting thing is that the position must be given in characters, not bytes. We can easily count bytes in a string, but if any U8 characters are in the script they throw the byte count out of sync with the character count. On Thu, Sep 10, 2015 at 8:36 PM, Raul Miller <[email protected]> wrote: > That looks promising, but somehow it doesn't quite seem to work like I > would expect, given that documentation: > > test=:3 :0 > open '~user/temp/1.ijs' > wd 'sm set edit -1 30 -1 -1' > ) > > test'' > |sm : unrecognized sm command: set edit 30 -1 -1 > > test=: 3 : 0 > open '~user/temp/1.ijs' > wd 'sm set edit * 0 30 -1 -1' > ) > > test'' > |sm : unrecognized sm command: set edit 0 30 -1 -1 > > Are there working examples of positioning the active edit window to a > given line? > > Thanks, > > -- > Raul > > > On Thu, Sep 10, 2015 at 8:24 PM, Henry Rich <[email protected]> wrote: > > J804 has many commands for working with term and edit windows. See > > > > http://www.jsoftware.com/jwiki/Guides/Window%20Driver/Session%20Manager > > > > Henry Rich > > > > > > On 9/10/2015 2:37 PM, Raul Miller wrote: > >> > >> Speaking of things we miss from j602, I really liked the (edit) verb, > >> for inspecting definitions in context. > >> > >> Here's the best I can currently approximate it in j804: > >> > >> edit=:3 :0 > >> open (4!:3''){~4!:4<y > >> ) > >> > >> Example use: > >> > >> edit 'tsrep' > >> > >> This example gives me system/main/stdlib.ijs in an editor window. What > >> it doesn't do is find anything that looks like the definition of tsrep > >> in that file. > >> > >> And there's some justice for that - sometimes what looks like the > >> definition isn't really the definition. But I'd like to try. Maybe put > >> a user interface in front of it, if it seems ambiguous? > >> > >> But I don't know how to move to a position within the opened file. > >> > >> Looking at the definition of open: > >> > >> 3 : 'wd ''openj *'' , > {. getscripts_j_ y' > >> > >> So it's a wd command. But google is useless, and I don't specifically > >> know where to go to find any relevant reference. > >> > >> Looking through: > >> > >> http://www.jsoftware.com/jwiki/Guides/Window%20Driver/ChildClasses > >> > http://www.jsoftware.com/jwiki/Guides/Window%20Driver/Command%20Reference > >> http://www.jsoftware.com/jwiki/Guides/Window%20Driver/Parent > >> http://www.jsoftware.com/jwiki/Guides/Window%20Driver/Window%20Controls > >> > >> > http://www.jsoftware.com/jwiki/Guides/Window%20Driver/Window%20Driver%20Overview > >> > >> finds me nothing on 'openj'. > >> > >> I might be able to find something under http://jsoftware.com/websvn/ > >> but that's a fairly hostile environment for searching. Still, spending > >> a few minutes there suggests that the c++ sources are no longer > >> visible to me. > >> > >> At a guess, though, the code is currently not designed to support J > >> driving the behavior of the edit windows. > >> > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
