From 3512148cd14f2f4430b1045fa61e952083a2a4b0 Mon Sep 17 00:00:00 2001 From: ElectricAlchemist Date: Tue, 29 Oct 2019 20:28:08 +0100 Subject: [PATCH] bugfixes --- ste | Bin 22168 -> 22168 bytes ste.c | 41 ++++++----------------------------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/ste b/ste index e76b79f24642e5cabd7c4c5036c8794b18269b87..11f48d24ce9781e9c6af50990af137969f161b51 100755 GIT binary patch delta 3183 zcmY*b4{#LK8Q;CVO)lYbn~+>`3Cdl_-84~<9B`B?oMvG|_Uxe%!L}%hMj0JMPy#X* za;KM5me&ozH_l|JQ|+H|N()L2BMw%$#CRdJl_afDC~cz+vKLe|MGO$w{@z`n7zw6k`ckJccUHrbC<>&LiaB`XUg|l-q-_4iAq(2wUc;u;ZZA?2gdbs7> zqprm}I}OW_Sl;f=GW(Zgr7bJC#?DV{9eKQ)J~#Oho}>Sqd zi6)9)Qy(42o{ zQZI?AL{N2Wf8wIl=0I4LY_|Ca{mIpmyET(UY(Z|G)LP18DxT!y-Fz?=J*PPn%$$Vo zg79A?&NmitQO@WZH%$_H7FfcR+636t`-jg>hcAWWDb=v66i8|m9 zX&r#=b^1?PQcf}J^cR?5aZ58i;fMONy`0(RWMcUOXJj~ObIstyI#WYv(F7Am@Nsd zfFREO=mlp>@FsjpU)EwFAmi#-#(FN(pQoqGR(LPZ1793xeF3BBb1d;RAN)wte}fX> z1Zd6^bcO4thf`QBBHBRF#5X}tuVwRN`OSIpu>vWv$%^nzqJbHOgkH&r8QYlhAd47|gaNRwr^jp&mlPzAGVWw zb~B}EITzLxuT3QzZK~EQYb9R8L)VrsKyUf zBieacTf!O3MdTgGr7acS{9TyKc-l$#RLtZn>FJ7FqAvoh*Jd)?_fVdQcGjo@6c-EU zava|)S|C{K6}bs5{T>!ba&w_OarULw*U-!F=7ADg#(+d8dWHB-23TEvN152Bc&nE* z4WsCXF{~GEU$SPnIwDlbgl?TOnSYG7PuUW!zQ8`=tg%m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-GScBa>NJZ4maTVFb>-oPGkr;8Kl`kNQLHON>)*v^WX<4 zuJm#;26*EW_VbeK#@so{*SQ+LP>qo-Pf#fd1-sh*42Su~{1bpEy^lT}B@Qf2&7p%4 z7)X{vXl8g1+h2VBoev>Bnwc%8L^z5Kv^~WELHHt7$)JV!Jf>95MQFUmqfzN%74&$b zCDT4JS$%I!O7JsN{Gg+n%_^CxzB5U6*(cJE=~ZT1_#{>lwk%ky>ERt<;l>?l$wDO^ z1a9p+kG=gqg6Wf9WsjB2tB7-S|G89s{fO&}J_F-JbhxRlOBi^QmyFfQ21`n&X*eNf zE$VWkOCQgXcigqxSCIL=TtR4-HwGVJKHuM*=jD!jSfI2ZLku02O@*tHldG(%w8#lL zg+o&^I5Z}()us9D@zP_lthcd>P|D zRS~?k8eQ&HL!#WV3k;2Ja2ZEx<(FC{l=zqCN}`c*t?6=2+eGG;cl(5GoXx%ZoJ)LW ztwW=$yxQJACxHM$R-OZVTeRY9O+VwZW^^4a&v);xdNGiTirC7FUxLkb9ShDh2+DrCSB7OzU*eV zII=RY{#dVJL*dm9|Lm^oZ+g_pU=WD?pF&6g-PcW1Kr(|q#E|5T2I=#j;o^tF?X+6hd5YK{Qge2JJ$S#L(c9&!2OD@N>Ja%Z!e7ApgdLD#)e$4^#zfBUgmH+?% diff --git a/ste.c b/ste.c index 864aa96..850b799 100644 --- a/ste.c +++ b/ste.c @@ -5,7 +5,7 @@ /* defines */ #define CTRL(k) ((k) & 0x1f) // Control mask modifier -#define TABSIZE 8 // Tab size as used in render +#define TABSIZE 4 // Tab size as used in render /* main data structure containing: * -cursor position @@ -517,7 +517,7 @@ void updateScroll (void) /* Set x offeset */ if (t.cur.x >= t.dim.x) { - if (t.cur.x == t.dim.x) t.cur.off_x++; + if (t.cur.x == t.dim.x - 1) t.cur.off_x++; else t.cur.off_x += t.cur.x - t.dim.x; t.cur.x = t.dim.x; @@ -554,36 +554,6 @@ int whatsThat (void) { return 0; } -/* void rowAddRow (void) //VERY WIP -{ - int cur_x = t.cur.x + t.cur.off_x; - int cur_y = t.cur.y + t.cur.off_y; - char *s = NULL; - - // Last line case - if (cur_y == rows.rownum - 1) { - if (rows.rw[cur_y].chars[cur_x] != '\0') { - //copy the previous string - s = malloc(rows.rw[cur_y].size + 1); - memcpy (s, &rows.rw[cur_y].chars, rows.rw[cur_y].size + 1); - } - cur_y++; - rows.rownum++; - rows.rw = realloc(rows.rw, sizeof(row) * rows.rownum); - if (s == NULL) { - rows.rw[cur_y].chars = malloc(1); - rows.rw[cur_y].chars[0] = '\0'; - } else { - rows.rw[cur_y].chars = malloc(strlen(s) + 1); - memcpy(rows.rw[cur_y].chars, s, strlen(s)); - rows.rw[cur_y].chars[strlen(s) + 1] = '\0'; - } - free(s); - updateRender(&rows.rw[cur_y]); - t.cur.y++; - } -} */ - void rowAddRow (int pos) // WIP; TO DOCUMENT { int cur_x = t.cur.x + t.cur.off_x; @@ -626,9 +596,10 @@ void rowAddRow (int pos) // WIP; TO DOCUMENT updateRender(&rows.rw[pos + 1]); } else rowAddLast(s, l); - free(s); - t.cur.y++; - t.cur.x = 0; + free(s); + t.cur.y++; + t.cur.x = 0; + t.cur.off_x = 0; } void rowFree (row *rw) // WIP