HelenOS sources
history 90 kernel/generic/src/console/kconsole.c static char32_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = { };
history 105 kernel/generic/src/console/kconsole.c history[i][0] = 0;
history 341 kernel/generic/src/console/kconsole.c char32_t *current = history[history_pos];
history 500 kernel/generic/src/console/kconsole.c current = history[history_pos];
history 134 uspace/lib/clui/include/tinput.h char *history[HISTORY_LEN + 1];
history 460 uspace/lib/clui/src/tinput.c if (ti->history[HISTORY_LEN] != NULL)
history 461 uspace/lib/clui/src/tinput.c free(ti->history[HISTORY_LEN]);
history 466 uspace/lib/clui/src/tinput.c ti->history[i] = ti->history[i - 1];
history 468 uspace/lib/clui/src/tinput.c ti->history[1] = str_dup(str);
history 470 uspace/lib/clui/src/tinput.c if (ti->history[0] != NULL) {
history 471 uspace/lib/clui/src/tinput.c free(ti->history[0]);
history 472 uspace/lib/clui/src/tinput.c ti->history[0] = NULL;
history 583 uspace/lib/clui/src/tinput.c if (ti->history[ti->hpos] != NULL) {
history 584 uspace/lib/clui/src/tinput.c free(ti->history[ti->hpos]);
history 585 uspace/lib/clui/src/tinput.c ti->history[ti->hpos] = NULL;
history 588 uspace/lib/clui/src/tinput.c ti->history[ti->hpos] = tinput_get_str(ti);
history 591 uspace/lib/clui/src/tinput.c int pad = (int) ti->nc - str_length(ti->history[ti->hpos]);
history 595 uspace/lib/clui/src/tinput.c tinput_set_str(ti, ti->history[ti->hpos]);
history 793 uspace/lib/clui/src/tinput.c ti->history[0] = NULL;
history 116 uspace/lib/termui/src/history.c static bool _index_valid(const struct history *history, size_t idx)
history 118 uspace/lib/termui/src/history.c const struct line_buffer *lines = &history->lines;
history 127 uspace/lib/termui/src/history.c #define _history_check(history) do { \
history 128 uspace/lib/termui/src/history.c assert(history->lines.head < history->lines.buf_len); \
history 129 uspace/lib/termui/src/history.c assert(history->lines.tail < history->lines.buf_len); \
history 130 uspace/lib/termui/src/history.c assert(history->cells.tail_top <= history->cells.head_offset); \
history 131 uspace/lib/termui/src/history.c assert(history->cells.head_offset <= history->cells.head_top); \
history 132 uspace/lib/termui/src/history.c assert(history->cells.head_top <= history->cells.buf_len); \
history 133 uspace/lib/termui/src/history.c assert(_index_valid(history, history->viewport_top) || history->viewport_top == history->lines.tail); \
history 134 uspace/lib/termui/src/history.c if (history->append) assert(!_lines_empty(&history->lines)); \
history 137 uspace/lib/termui/src/history.c static void _evict_oldest_line(struct history *history)
history 139 uspace/lib/termui/src/history.c struct line_buffer *lines = &history->lines;
history 140 uspace/lib/termui/src/history.c struct cell_buffer *cells = &history->cells;
history 142 uspace/lib/termui/src/history.c _history_check(history);
history 144 uspace/lib/termui/src/history.c bool head = (history->viewport_top == lines->head);
history 152 uspace/lib/termui/src/history.c history->viewport_top = 0;
history 153 uspace/lib/termui/src/history.c history->append = false;
history 154 uspace/lib/termui/src/history.c history->row_delta = 0;
history 158 uspace/lib/termui/src/history.c history->viewport_top = lines->head;
history 159 uspace/lib/termui/src/history.c history->row_delta = 0;
history 162 uspace/lib/termui/src/history.c _history_check(history);
history 167 uspace/lib/termui/src/history.c _history_check(history);
history 171 uspace/lib/termui/src/history.c _history_check(history);
history 271 uspace/lib/termui/src/history.c static void _alloc_line(struct history *history)
history 273 uspace/lib/termui/src/history.c struct line_buffer *lines = &history->lines;
history 291 uspace/lib/termui/src/history.c bool viewport_inactive = (history->viewport_top == lines->tail);
history 302 uspace/lib/termui/src/history.c _evict_oldest_line(history);
history 307 uspace/lib/termui/src/history.c history->viewport_top = lines->tail;
history 312 uspace/lib/termui/src/history.c history->append = true;
history 314 uspace/lib/termui/src/history.c _history_check(history);
history 339 uspace/lib/termui/src/history.c static termui_cell_t *_history_append(struct history *history, size_t len)
history 341 uspace/lib/termui/src/history.c struct line_buffer *lines = &history->lines;
history 342 uspace/lib/termui/src/history.c struct cell_buffer *cells = &history->cells;
history 362 uspace/lib/termui/src/history.c _evict_oldest_line(history);
history 369 uspace/lib/termui/src/history.c if (!history->append || _lines_empty(lines)) {
history 370 uspace/lib/termui/src/history.c _alloc_line(history);
history 386 uspace/lib/termui/src/history.c _alloc_line(history);
history 402 uspace/lib/termui/src/history.c bool _scrollback_active(const struct history *history)
history 404 uspace/lib/termui/src/history.c if (history->viewport_top == history->lines.tail)
history 407 uspace/lib/termui/src/history.c assert(_index_valid(history, history->viewport_top));
history 411 uspace/lib/termui/src/history.c static size_t _history_line_rows(const struct history *history, size_t idx)
history 413 uspace/lib/termui/src/history.c assert(_index_valid(history, idx));
history 415 uspace/lib/termui/src/history.c struct history_line line = history->lines.buf[idx];
history 420 uspace/lib/termui/src/history.c return (line.len - 1) / history->cols + 1;
history 423 uspace/lib/termui/src/history.c static int _history_scroll_down(struct history *history, int requested)
history 431 uspace/lib/termui/src/history.c if (history->row_delta > 0) {
history 432 uspace/lib/termui/src/history.c size_t rows = _history_line_rows(history, history->viewport_top);
history 433 uspace/lib/termui/src/history.c assert(rows > history->row_delta);
history 435 uspace/lib/termui/src/history.c if (delta < rows - history->row_delta) {
history 436 uspace/lib/termui/src/history.c history->row_delta += delta;
history 437 uspace/lib/termui/src/history.c _history_check(history);
history 441 uspace/lib/termui/src/history.c delta -= rows - history->row_delta;
history 442 uspace/lib/termui/src/history.c history->row_delta = 0;
history 444 uspace/lib/termui/src/history.c _line_idx_inc(&history->lines, &history->viewport_top);
history 449 uspace/lib/termui/src/history.c while (_scrollback_active(history)) {
history 450 uspace/lib/termui/src/history.c size_t rows = _history_line_rows(history, history->viewport_top);
history 454 uspace/lib/termui/src/history.c history->row_delta = delta;
history 455 uspace/lib/termui/src/history.c _history_check(history);
history 461 uspace/lib/termui/src/history.c _line_idx_inc(&history->lines, &history->viewport_top);
history 465 uspace/lib/termui/src/history.c _history_check(history);
history 469 uspace/lib/termui/src/history.c static int _history_scroll_up(struct history *history, int requested)
history 474 uspace/lib/termui/src/history.c if (history->row_delta > INT_MAX) {
history 475 uspace/lib/termui/src/history.c history->row_delta += requested;
history 476 uspace/lib/termui/src/history.c _history_check(history);
history 480 uspace/lib/termui/src/history.c int delta = requested + (int) history->row_delta;
history 481 uspace/lib/termui/src/history.c history->row_delta = 0;
history 483 uspace/lib/termui/src/history.c while (delta < 0 && history->viewport_top != history->lines.head) {
history 484 uspace/lib/termui/src/history.c _line_idx_dec(&history->lines, &history->viewport_top);
history 486 uspace/lib/termui/src/history.c size_t rows = _history_line_rows(history, history->viewport_top);
history 489 uspace/lib/termui/src/history.c history->row_delta = rows + delta;
history 490 uspace/lib/termui/src/history.c _history_check(history);
history 497 uspace/lib/termui/src/history.c _history_check(history);
history 503 uspace/lib/termui/src/history.c history->row_delta = (size_t) delta;
history 507 uspace/lib/termui/src/history.c static int _history_scroll_to_top(struct history *history)
history 509 uspace/lib/termui/src/history.c history->viewport_top = history->lines.head;
history 510 uspace/lib/termui/src/history.c history->row_delta = 0;
history 511 uspace/lib/termui/src/history.c _history_check(history);
history 515 uspace/lib/termui/src/history.c static int _history_scroll_to_bottom(struct history *history)
history 517 uspace/lib/termui/src/history.c history->viewport_top = history->lines.tail;
history 518 uspace/lib/termui/src/history.c _history_check(history);
history 528 uspace/lib/termui/src/history.c int _history_scroll(struct history *history, int delta)
history 531 uspace/lib/termui/src/history.c return _history_scroll_to_top(history);
history 533 uspace/lib/termui/src/history.c return _history_scroll_to_bottom(history);
history 535 uspace/lib/termui/src/history.c return _history_scroll_down(history, delta);
history 537 uspace/lib/termui/src/history.c return _history_scroll_up(history, delta);
history 551 uspace/lib/termui/src/history.c const termui_cell_t *_history_reflow(struct history *history, size_t new_cols, size_t *recouped)
history 553 uspace/lib/termui/src/history.c history->row_delta = (history->row_delta * history->cols) / new_cols;
history 554 uspace/lib/termui/src/history.c history->cols = new_cols;
history 556 uspace/lib/termui/src/history.c if (!history->append) {
history 562 uspace/lib/termui/src/history.c assert(!_lines_empty(&history->lines));
history 564 uspace/lib/termui/src/history.c size_t last_idx = history->lines.tail;
history 565 uspace/lib/termui/src/history.c _line_idx_dec(&history->lines, &last_idx);
history 567 uspace/lib/termui/src/history.c struct history_line *last = &history->lines.buf[last_idx];
history 570 uspace/lib/termui/src/history.c if (last->idx + last->len == history->cells.head_top) {
history 571 uspace/lib/termui/src/history.c history->cells.head_top -= *recouped;
history 573 uspace/lib/termui/src/history.c assert(last->idx + last->len == history->cells.tail_top);
history 574 uspace/lib/termui/src/history.c history->cells.tail_top -= *recouped;
history 579 uspace/lib/termui/src/history.c assert(history->cells.tail_top == 0);
history 580 uspace/lib/termui/src/history.c last->idx = history->cells.head_top;
history 583 uspace/lib/termui/src/history.c return &history->cells.buf[last->idx + last->len];
history 592 uspace/lib/termui/src/history.c int _history_viewport_rows(const struct history *history, size_t max)
history 594 uspace/lib/termui/src/history.c if (!_scrollback_active(history))
history 597 uspace/lib/termui/src/history.c size_t current = history->viewport_top;
history 598 uspace/lib/termui/src/history.c size_t rows = _history_line_rows(history, current) - history->row_delta;
history 599 uspace/lib/termui/src/history.c _line_idx_inc(&history->lines, ¤t);
history 601 uspace/lib/termui/src/history.c while (rows < max && current != history->lines.tail) {
history 602 uspace/lib/termui/src/history.c rows += _history_line_rows(history, current);
history 603 uspace/lib/termui/src/history.c _line_idx_inc(&history->lines, ¤t);
history 621 uspace/lib/termui/src/history.c static void _adjust_row_delta(const struct history *history, size_t *line_idx, size_t *delta)
history 623 uspace/lib/termui/src/history.c while (*line_idx != history->lines.tail) {
history 624 uspace/lib/termui/src/history.c size_t rows = _history_line_rows(history, *line_idx);
history 629 uspace/lib/termui/src/history.c _line_idx_inc(&history->lines, line_idx);
history 643 uspace/lib/termui/src/history.c int _history_iter_rows(const struct history *history, int row, int count, termui_update_cb_t cb, void *udata)
history 645 uspace/lib/termui/src/history.c assert(history->row_delta <= SIZE_MAX - row);
history 647 uspace/lib/termui/src/history.c size_t current_line = history->viewport_top;
history 648 uspace/lib/termui/src/history.c size_t delta = history->row_delta + (size_t) row;
history 650 uspace/lib/termui/src/history.c _adjust_row_delta(history, ¤t_line, &delta);
history 654 uspace/lib/termui/src/history.c while (count > 0 && current_line != history->lines.tail) {
history 656 uspace/lib/termui/src/history.c assert(_index_valid(history, current_line));
history 658 uspace/lib/termui/src/history.c struct history_line line = history->lines.buf[current_line];
history 659 uspace/lib/termui/src/history.c assert(line.len <= history->cells.buf_len);
history 660 uspace/lib/termui/src/history.c assert(line.idx <= history->cells.buf_len - line.len);
history 664 uspace/lib/termui/src/history.c _update_blank(0, row, history->cols, cb, udata);
history 667 uspace/lib/termui/src/history.c _line_idx_inc(&history->lines, ¤t_line);
history 671 uspace/lib/termui/src/history.c const termui_cell_t *cells = &history->cells.buf[line.idx];
history 672 uspace/lib/termui/src/history.c size_t line_offset = delta * history->cols;
history 677 uspace/lib/termui/src/history.c while (count > 0 && line_offset + history->cols <= line.len) {
history 678 uspace/lib/termui/src/history.c assert(line.idx + line_offset <= history->cells.buf_len - history->cols);
history 679 uspace/lib/termui/src/history.c cb(udata, 0, row, &cells[line_offset], history->cols);
history 681 uspace/lib/termui/src/history.c line_offset += history->cols;
history 692 uspace/lib/termui/src/history.c assert(col < history->cols);
history 695 uspace/lib/termui/src/history.c _update_blank(col, row, history->cols - col, cb, udata);
history 701 uspace/lib/termui/src/history.c _line_idx_inc(&history->lines, ¤t_line);
history 714 uspace/lib/termui/src/history.c void _history_append_row(struct history *history, const termui_cell_t *b, bool last)
history 716 uspace/lib/termui/src/history.c size_t len = history->cols;
history 724 uspace/lib/termui/src/history.c memcpy(_history_append(history, len), b, sizeof(termui_cell_t) * len);
history 727 uspace/lib/termui/src/history.c history->append = false;
history 80 uspace/lib/termui/src/history.h INTERNAL bool _scrollback_active(const struct history *history);
history 81 uspace/lib/termui/src/history.h INTERNAL void _history_append_row(struct history *history, const termui_cell_t *b, bool last);
history 82 uspace/lib/termui/src/history.h INTERNAL int _history_viewport_rows(const struct history *history, size_t max);
history 83 uspace/lib/termui/src/history.h INTERNAL int _history_iter_rows(const struct history *history, int row, int count, termui_update_cb_t cb, void *udata);
history 84 uspace/lib/termui/src/history.h INTERNAL int _history_scroll(struct history *history, int delta);
history 85 uspace/lib/termui/src/history.h INTERNAL const termui_cell_t *_history_reflow(struct history *history, size_t new_cols, size_t *recouped);
history 62 uspace/lib/termui/src/termui.c struct history history;
history 111 uspace/lib/termui/src/termui.c _history_append_row(&termui->history, &_screen_cell(termui, 0, 0), last);
history 149 uspace/lib/termui/src/termui.c int viewport_rows = _history_viewport_rows(&termui->history, termui->rows);
history 181 uspace/lib/termui/src/termui.c size_t old_top = termui->history.viewport_top;
history 185 uspace/lib/termui/src/termui.c if (old_top != termui->history.viewport_top && termui->refresh_cb)
history 188 uspace/lib/termui/src/termui.c if (termui->scroll_cb && !_scrollback_active(&termui->history))
history 505 uspace/lib/termui/src/termui.c int sb_rows = _history_viewport_rows(&termui->history, termui->rows);
history 506 uspace/lib/termui/src/termui.c int updated = _history_iter_rows(&termui->history, first_row, rows, termui->update_cb, termui->update_udata);
history 520 uspace/lib/termui/src/termui.c return _scrollback_active(&termui->history);
history 537 uspace/lib/termui/src/termui.c termui->history.lines.max_len = history_lines;
history 539 uspace/lib/termui/src/termui.c termui->history.cells.max_len = SIZE_MAX;
history 541 uspace/lib/termui/src/termui.c termui->history.cells.max_len = history_lines * cols;
history 542 uspace/lib/termui/src/termui.c termui->history.cols = cols;
history 576 uspace/lib/termui/src/termui.c int scrolled = _history_scroll(&termui->history, delta);
history 656 uspace/lib/termui/src/termui.c termui->history.lines.max_len = history_lines;
history 659 uspace/lib/termui/src/termui.c termui->history.cells.max_len = SIZE_MAX;
history 661 uspace/lib/termui/src/termui.c termui->history.cells.max_len = history_lines * cols;
history 669 uspace/lib/termui/src/termui.c const termui_cell_t *c = _history_reflow(&termui->history, cols, &recouped);
HelenOS homepage, sources at GitHub