In addition to being more efficient, this will simplify the next bugfix.
UBA2ZUCP3JP5SGM2R5O5X5VP6DY64Y76MH65UPSHNWEUXRPZISPQC
SDEY7LFJ4LY735OZAJ6X5Y2SE3MFBT4X4TWLHVW3SS2JAK757E6QC
IAWCZRFUJLNTAISO3GFQOFPSH7QMDKZZFN4UPBJ5UHXKJYV42W7AC
6WDBV52ZFEYAUK6L66LDOKJ5JGHP63VY5R4NDOROZDY6HZJF45KAC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
I64IPGJXWRTGHHVAYJUBUIWFR4BY6NM5P7TLTV4JOD7K4BVYDECQC
HALS7E5UGKCP3DFY456F7Z3Y6WNGIABOCV2SHT34D5ZAGNCPV5PQC
X3F7ECSLGXCH6NBSDIH7LY47I4EG2RR5VFPEMM6ZVDYQIGFID4HQC
DHI6IJCNSTHGED67T6H5X6Y636C7PIDGIJD32HBEKLT5WIMRS5MAC
FZBXBUFFNRE5ZJO5DLRU375HOXT2B7FO35XD7BTHHUXSARVWDFLQC
H2DPLWMVRFYTO2CQTG54FMT2LF3B6UKLXH32CUA22DNQJVP5XBNQC
KMSL74GAMFNTAKGDKZFP2AMQXUMOC3XH373BO4IABZWBEP3YAXKAC
GZ5WULJVEZJJQPQPSQZE7CEPIYPJ2BJDYUJBMZRA5HLOO7TE3DOQC
KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC
CQWVUCXZTEFR6LAI6WIVJXRX6RB2O5KVZRC3ACL24TCMMPKGD7MQC
local lo_px = Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi)
App.color(Text_color)
love.graphics.print(State.search_term, State.left+lo_px,y)
Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi)
end
-- render colorized text
local x = State.left
for frag in screen_line:gmatch('%S*%s*') do
select_color(frag)
App.screen.print(frag, x,y)
x = x+App.width(frag)
local lo_px = Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi)
App.color(Text_color)
love.graphics.print(State.search_term, State.left+lo_px,y)
Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi)