From 3c134a917fcc4668078959bc61728ef2423ea453 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Fri, 2 Jun 2023 18:53:15 +0000 Subject: [PATCH] Add delete key functionality .Fix Backspace line erase bug. Co-authored-by: sigonasr2 --- C++ProjectTemplate.wasm | Bin 312683 -> 313211 bytes main.cpp | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/C++ProjectTemplate.wasm b/C++ProjectTemplate.wasm index 4797be02d7fc78df454f1007db736a196bbf3d59..b26c2532eed260cb1e71fa5add2a740f6fe29247 100755 GIT binary patch delta 1557 zcmc&!J#Q015Z&3mI~&fvobn+;EWzB8!bq_YjUy#Uc!iQ+1PLEXL5C>sK!T3WktmQT zD6j+_`~{>S0bPoeDO^xchKhm;(I6<`&0ZX2ln6R(ozMF*Gw;25yPqFV{CG0)>dUx( zIoSLAvEQ-)9)E$7G1_W8$POOo-VWw*o z%gc0F&#Bn;m%3?>PHQ!fQd+QA+q#NSwV>kig?Y({MZrXDR_a*tSu;t7u#$r?28WfP zgY4K`_!uhYlmd2?2XvLbgKpqtNzxz>n_e3LYbHh_)AcHt^ixzD)mJYeftOZ0b-4~S zd)xsIb@5w>UI81CJ7lj{qb(D@E|NpX*pk;V^g5#195&K;U&xI5gSDxqXeXqRH!L|1 z+chdJQZ z;&xSjNFcWD1$ror!W|ibg3bz-P2hn0b`os18d!m%jUk7a5JzHhkT9h;!Qp)(mh~!7 z-qyg5ER&faDuFQwc?!a-f|L1oHeJ~>lwr!VIUsO^jdBA3i9F(^x&pABB+n}Sx7Rzs zJEAmI`zLQa1;+|@4=GlJqGCz#PYkCHV;FMvPlh8v1NdEvEE~D?1Vdm+j$XwDIAxiF zP2_Z2KuhH^xFij*a=A+X&IL+8YnfT z0pe1H&Q;`Z)k)8);>*drrI7L9wjDqUEk#Oy*#t*jn$N1SIK8DFHrF3D*9nitW8O5^ IgA4b50bwZD=l}o! delta 1003 zcmbu8ziSjx5XWa`-|i81v$rG$qSwql1ExsY^*Ds=Q{oTM6lyr^tamN6GTk0n2o@@C z=|3SP5bOfBSER78jFq63*a#Lnv%89kcOqCkc6Z+U&V0TzZ@)cV{Pbk;)#n9zHrf5M zuyvvQ7-CSK1(y`otN?=>kH=rVl-|XZQO4*tE}M*DmG)vwt7I&0%D23MMF-dCiAi@4 zVmTV!%Ow~U){}$mtwU&i_75Cf?WG!E6d5CGw2hB#Ylm-UnxXmTF3n!y*+; zQ-SIVv<9I_TM7q5044`gA@V|f8$$blh{8tN_oM(yGK&p~8qjPTwJFw|)^p$S0egze zc&&DZ$%i1qu$H>hH>9RLr^`xnU=mpaR^;Daxg1~pmv}>>M%J9*sMX< z!Iq>n;x&0q3TBk_nDhwp*;@Rit$BKdn`?QZ6F|$=-CHlqdMuN;9+YrP-&2~z>`S2E zwB;~nO74i6w{dP|j@lB;rQM;Dpt~z#R%s zpxm@M57nF7S^P)Om$6fw+kP?2q^keP={2f$(kLu#~!~bTO+34vEa<7^@ bq&FzZR|vX~2BXJ=5y~Q2-u_@@F5UkD#uArn diff --git a/main.cpp b/main.cpp index 0da8662..0bf1d7d 100644 --- a/main.cpp +++ b/main.cpp @@ -110,12 +110,22 @@ public: void GetAnyKeyPress(olc::Key k)override{ lastBlinkTime=0.5f; + if (k==DEL){ + if (cursors[0].pos==document[cursors[0].line].size()){ + if (cursors[0].line0){ cursors[0].pos=document[cursors[0].line-1].size(); document[cursors[0].line-1].append(document[cursors[0].line]); - document[cursors[0].line--].clear(); + document.erase(document.begin()+cursors[0].line--); } } else { document[cursors[0].line].erase(cursors[0].pos---1,1);