wishlist item: wGetLine

Started by kdmoyers, July 22, 2019, 04:52:19 AM

Previous topic - Next topic

kdmoyers

Pie-in-the-sky wishlist item: wGetLine

Because there is no wGetLine, you have to do wCopyLine and ClipGet, which are sometimes super slow.
(see attached trace file) (full code attached)

Sometimes, either wCopyLine or ClipGet takes a full second to run.  But not always. I dunno why.  I suspect it relates to conditions outside winbatch?

I'm presuming they are slow because of clipboard involvement, so perhaps the more direct wGetLine would be much faster?
I'd prefer to not have to disturb the clipboard anyway.

Just an Idea.

-Kirby
The mind is everything; What you think, you become.

td

Both wCopyLine or ClipGet wait for the clipboard to become available.  Unfortunately,  the waiting period between attempts to access the clipboard is set to too long a time value.  The value may have been appropriate in the days of single-core processors but obviously could be shorted quite a bit now.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

kdmoyers

Ah, that explains the behavior!  Ironic, because I don't even want to touch the clipboard.

I'm just trying to get the current line of the document, thus the request for a new editor function wGetLine to return that.

I have a workaround: I'm currently fiddling with some sort of loop to repeatedly call wGetWord to build up the line piecewise.

-Kirby
The mind is everything; What you think, you become.

kdmoyers

This little loop does it very quickly, I guess I don't need wGetLine

Code (winbatch) Select
        ; build up current line using wGetChar
        s = ""
        wEnd()
        while wGetColNo() > 1
          wleft()
          s = wGetChar() : s
        endwhile
The mind is everything; What you think, you become.