viewpoint-particle

Author Topic: wishlist item: wGetLine  (Read 117 times)

kdmoyers

  • Sr. Member
  • ****
  • Posts: 280
wishlist item: wGetLine
« on: July 22, 2019, 04:52:19 am »
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

  • Tech Support
  • *****
  • Posts: 3017
    • WinBatch
Re: wishlist item: wGetLine
« Reply #1 on: July 22, 2019, 09:35:14 am »
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

  • Sr. Member
  • ****
  • Posts: 280
Re: wishlist item: wGetLine
« Reply #2 on: July 22, 2019, 12:25:59 pm »
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

  • Sr. Member
  • ****
  • Posts: 280
Re: wishlist item: wGetLine
« Reply #3 on: July 23, 2019, 06:52:25 am »
This little loop does it very quickly, I guess I don't need wGetLine

Code: Winbatch
        ; 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.