libdraw: fix ^W corner case tick == 0 for enter()/eenter()
This commit is contained in:
parent
a77f6553d8
commit
aa3dd7fd8f
2 changed files with 6 additions and 2 deletions
|
@ -152,10 +152,12 @@ eenter(char *ask, char *buf, int len, Mouse *m)
|
|||
}
|
||||
if(k == Ketb){
|
||||
while(tick > 0){
|
||||
buf[--tick] = 0;
|
||||
tick--;
|
||||
if(tick == 0 || strchr("\t ", buf[tick-1]))
|
||||
break;
|
||||
}
|
||||
if(n > tick)
|
||||
memset(buf+tick, 0, n-tick);
|
||||
n = tick;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -160,10 +160,12 @@ enter(char *ask, char *buf, int len, Mousectl *mc, Keyboardctl *kc, Screen *scr)
|
|||
}
|
||||
if(k == Ketb){
|
||||
while(tick > 0){
|
||||
buf[--tick] = 0;
|
||||
tick--;
|
||||
if(tick == 0 || strchr("\t ", buf[tick-1]))
|
||||
break;
|
||||
}
|
||||
if(n > tick)
|
||||
memset(buf+tick, 0, n-tick);
|
||||
n = tick;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue