From: Matthieu C. <cho...@gm...> - 2008-01-22 09:25:31
|
Hi, maybe it could work, but if there are other requests, the macro will wait for all of them even if they aren't related with that buffer Matthieu On Jan 21, 2008 8:15 PM, Robert Schwenn <Ro...@sc...> wrote: > > > Hi, what's about to apply this simple method after initiating an I/O > operation: VFSManager.waitForRequests(); > > Some times ago I found the following comment in a macro or a forum post: > "jEdit waits then for the file to be completely loaded before continuing. > Yes, it works for file save operations too. It's designed for waiting on all > pending I/O requests." > > Should this be equivalent to EditBus Message handling (in this case)? > > Robert > > > > Matthieu Casanova wrote: > > Hi, you have to create an EBComponent and register it on the EditBus > to listen for the BUFFER_LOADED message, and move the caret after > that. > Don't forget to unregister it after. > I think you may also use a BufferListener with the bufferLoaded() callback > > Matthieu > > On Jan 21, 2008 2:54 PM, Romulo A. Ceccon <rom...@gm...> wrote: > > > Hi. > > I want to write a macro for jEdit but am struggling with a few issues. > > My need is for a script which opens a file and scrolls the buffer to > some line. A simplified version of what I've tried follows: > > jEdit.openFile(view, "E:\\Temp\\diff.txt"); > textArea.scrollTo(100, 0, true); > > The problem is with the second statement. Apparently, when it > executes, the buffer has not yet loaded, and fails with an > ArrayIndexOutOfBoundsException (Array index out of range: 100). The > macro works if the file is already opened, though. How do I fix that? > > Additionally, I'd like to move the caret to the scrolled line and > select the whole line, but I couldn't find any pointers on it. The > jEdit api has a lot of methods which deal with the caret position but > there's no one to convert line number to caret position. I'm sure > there's some trick not obvious to a newbie like me. Does anybody have > an idea? > > Thanks in advance. > Romulo A. Ceccon > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > -- > ----------------------------------------------- > jEdit Developers' List > jEd...@li... > https://lists.sourceforge.net/lists/listinfo/jedit-devel > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > -- > ----------------------------------------------- > jEdit Developers' List > jEd...@li... > https://lists.sourceforge.net/lists/listinfo/jedit-devel > > |