Lines Matching refs:len
187 static void refreshLine(int fd, const char *prompt, char *buf, size_t len, size_t pos, size_t cols) {
193 len--;
196 while (plen+len > cols) {
197 len--;
205 if (write(fd,buf,len) == -1) return;
217 size_t len = 0;
235 if (nread <= 0) return len;
240 return len;
243 return (len == 0) ? -1 : (int)len;
249 if (pos > 0 && len > 0) {
250 memmove(buf+pos-1,buf+pos,len-pos);
252 len--;
253 buf[len] = '\0';
254 refreshLine(fd,prompt,buf,len,pos,cols);
258 if (pos > 0 && pos < len) {
262 if (pos != len-1) pos++;
263 refreshLine(fd,prompt,buf,len,pos,cols);
284 refreshLine(fd,prompt,buf,len,pos,cols);
289 if (pos != len) {
291 refreshLine(fd,prompt,buf,len,pos,cols);
312 len = pos = strlen(buf);
313 refreshLine(fd,prompt,buf,len,pos,cols);
318 if (len < buflen) {
319 if (len == pos) {
322 len++;
323 buf[len] = '\0';
324 if (plen+len < cols) {
329 refreshLine(fd,prompt,buf,len,pos,cols);
332 memmove(buf+pos+1,buf+pos,len-pos);
334 len++;
336 buf[len] = '\0';
337 refreshLine(fd,prompt,buf,len,pos,cols);
343 pos = len = 0;
344 refreshLine(fd,prompt,buf,len,pos,cols);
348 len = pos;
349 refreshLine(fd,prompt,buf,len,pos,cols);
353 refreshLine(fd,prompt,buf,len,pos,cols);
356 pos = len;
357 refreshLine(fd,prompt,buf,len,pos,cols);
361 return len;
392 size_t len;
397 len = strlen(buf);
398 while(len && (buf[len-1] == '\n' || buf[len-1] == '\r')) {
399 len--;
400 buf[len] = '\0';
431 int linenoiseHistorySetMaxLen(int len) {
434 if (len < 1) return 0;
438 new = malloc(sizeof(char*)*len);
440 if (len < tocopy) tocopy = len;
445 history_max_len = len;