davidgiven / wordgrinder

A word processor which gets the hell out of your way and lets you get some work done.
http://cowlark.com/wordgrinder
978 stars 61 forks source link

Instacrash on delete #253

Closed davidgiven closed 1 year ago

davidgiven commented 1 year ago

Sometimes when deleting a word, WG will instantly fall over:

[string "src/lua/paragraph.lua"]:280: word out of range
[string "src/lua/paragraph.lua"]:280 function getLineOfWord
[string "src/lua/redraw.lua"]:254 function RedrawScreen
[string "src/lua/main.lua"]:248 function eventloop
[string "src/lua/main.lua"]:278 function WordProcessor
[string "src/lua/main.lua"]:436 function Main

Lua error: [string "src/lua/paragraph.lua"]:280: word out of range
[string "src/lua/paragraph.lua"]:280 function getLineOfWord
[string "src/lua/redraw.lua"]:254 function RedrawScreen
[string "src/lua/forms.lua"]:707 function redraw_form
[string "src/lua/forms.lua"]:796 function Run
[string "src/lua/ui.lua"]:105 function ModalMessage
[string "src/lua/main.lua"]:281 function WordProcessor
[string "src/lua/main.lua"]:436 function Main

This appears to be because _sw is set to the last word of a paragraph, and when the paragraph is shortened _sw is out of range.