Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove varargs C-preprocessor macros from linenoise.c, since some older C compilers (ex: gcc on a circa-2000 iBook) are unable to deal with them. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
24c2b99df2f659140a1bedaef3a9a44d |
User & Date: | drh 2018-01-07 23:45:48.997 |
Context
2018-01-09
| ||
00:55 | Update SQLite to the latest 3.22.0 alpha. This might fix reported build problems on MinGW. ... (check-in: f7f168c3 user: drh tags: trunk) | |
2018-01-08
| ||
23:20 | Enlarge the diff view font and tweak the diff highlight colors. The skin was globally widened to accomodate more space for the diff view. ... (check-in: 34ab58c2 user: achavasse tags: skin-ardoise) | |
2018-01-07
| ||
23:45 | Remove varargs C-preprocessor macros from linenoise.c, since some older C compilers (ex: gcc on a circa-2000 iBook) are unable to deal with them. ... (check-in: 24c2b99d user: drh tags: trunk) | |
23:29 | Avoid the use of utimensat() on older unix platforms. ... (check-in: 2aa7a23b user: drh tags: trunk) | |
Changes
Changes to src/linenoise.c.
︙ | ︙ | |||
554 555 556 557 558 559 560 | /* Update maxrows if needed. */ if (rows > (int)l->maxrows) l->maxrows = rows; /* First step: clear all the lines used before. To do so start by * going to the last row. */ abInit(&ab); if (old_rows-rpos > 0) { | | | | | | | | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | /* Update maxrows if needed. */ if (rows > (int)l->maxrows) l->maxrows = rows; /* First step: clear all the lines used before. To do so start by * going to the last row. */ abInit(&ab); if (old_rows-rpos > 0) { /* lndebug("go down %d", old_rows-rpos); */ snprintf(seq,64,"\x1b[%dB", old_rows-rpos); abAppend(&ab,seq,strlen(seq)); } /* Now for every row clear it, go up. */ for (j = 0; j < old_rows-1; j++) { /* lndebug("clear+up"); */ snprintf(seq,64,"\r\x1b[0K\x1b[1A"); abAppend(&ab,seq,strlen(seq)); } /* Clean the top line. */ /* lndebug("clear"); */ snprintf(seq,64,"\r\x1b[0K"); abAppend(&ab,seq,strlen(seq)); /* Write the prompt and the current buffer content */ abAppend(&ab,l->prompt,strlen(l->prompt)); abAppend(&ab,l->buf,l->len); /* Show hits if any. */ refreshShowHints(&ab,l,plen); /* If we are at the very end of the screen with our prompt, we need to * emit a newline and move the prompt to the first column. */ if (l->pos && l->pos == l->len && (l->pos+plen) % l->cols == 0) { /* lndebug("<newline>"); */ abAppend(&ab,"\n",1); snprintf(seq,64,"\r"); abAppend(&ab,seq,strlen(seq)); rows++; if (rows > (int)l->maxrows) l->maxrows = rows; } /* Move cursor to right position. */ rpos2 = (plen+l->pos+l->cols)/l->cols; /* current cursor relative row. */ /* lndebug("rpos2 %d", rpos2); */ /* Go up till we reach the expected positon. */ if (rows-rpos2 > 0) { /* lndebug("go-up %d", rows-rpos2); */ snprintf(seq,64,"\x1b[%dA", rows-rpos2); abAppend(&ab,seq,strlen(seq)); } /* Set column. */ col = (plen+(int)l->pos) % (int)l->cols; /* lndebug("set col %d", 1+col); */ if (col) snprintf(seq,64,"\r\x1b[%dC", col); else snprintf(seq,64,"\r"); abAppend(&ab,seq,strlen(seq)); /* lndebug("\n"); */ l->oldpos = l->pos; if (write(fd,ab.b,ab.len) == -1) {} /* Can't recover from write error. */ abFree(&ab); } /* Calls the two low level functions refreshSingleLine() or |
︙ | ︙ |