rkusa / dcs-scratchpad

Resizable and movable DCS World ingame Scratchpad for quick notes - especially useful in VR.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getSelection returns incorrect values if any lines in buffer are word wrapped

aeronautes opened this issue · comments

getSelection works fine if all lines in buffer are shorter than current scratchpad window width. But once a line overflows and is wordwrapped, the calculation for newlines doesn't seem to match what the buffer thinks it is. It's as if window widget adds newlines but the count in textarea doesn't match.

Repro:

  1. start with empty buffer and click L/L button. It should output a latlong entry
  2. create a line that word wraps the buffer, eg hold down a letter key until it wraps down to another line
  3. click L/L button again. It should not show any change
  4. look at dcs.log, it should show something like:
    scratchpad-hook.lua"]:124: attempt to perform arithmetic on local 'startByte' (a nil value)