Lines Matching refs:ctx
46 size_t line_length = sh->ctx->cmd_buff_len + z_shell_strlen(sh->ctx->prompt); in full_line_cmd()
52 return (line_length % sh->ctx->vt100_ctx.cons.terminal_wid == 0U); in full_line_cmd()
58 return (((sh->ctx->cmd_buff_pos * sh->ctx->cfg.flags.echo) + in z_shell_cursor_in_empty_line()
59 z_shell_strlen(sh->ctx->prompt)) % in z_shell_cursor_in_empty_line()
60 sh->ctx->vt100_ctx.cons.terminal_wid == in z_shell_cursor_in_empty_line()
73 struct shell_multiline_cons *cons = &sh->ctx->vt100_ctx.cons; in z_shell_op_cursor_position_synchronize()
76 z_shell_multiline_data_calc(cons, sh->ctx->cmd_buff_pos, in z_shell_op_cursor_position_synchronize()
77 sh->ctx->cmd_buff_len); in z_shell_op_cursor_position_synchronize()
99 struct shell_multiline_cons *cons = &sh->ctx->vt100_ctx.cons; in z_shell_op_cursor_move()
100 uint16_t new_pos = sh->ctx->cmd_buff_pos + val; in z_shell_op_cursor_move()
104 z_shell_multiline_data_calc(cons, sh->ctx->cmd_buff_pos, in z_shell_op_cursor_move()
105 sh->ctx->cmd_buff_len); in z_shell_op_cursor_move()
109 &sh->ctx->vt100_ctx.cons, in z_shell_op_cursor_move()
110 sh->ctx->cmd_buff_pos, in z_shell_op_cursor_move()
113 &sh->ctx->vt100_ctx.cons, in z_shell_op_cursor_move()
114 sh->ctx->cmd_buff_pos, in z_shell_op_cursor_move()
119 sh->ctx->cmd_buff_pos = new_pos; in z_shell_op_cursor_move()
160 shift = shift_calc(sh->ctx->cmd_buff, in z_shell_op_cursor_word_move()
161 sh->ctx->cmd_buff_pos, in z_shell_op_cursor_word_move()
162 sh->ctx->cmd_buff_len, sign); in z_shell_op_cursor_word_move()
170 if ((sh->ctx->cmd_buff_len == 0) || in z_shell_op_word_remove()
171 (sh->ctx->cmd_buff_pos == 0)) { in z_shell_op_word_remove()
175 char *str = &sh->ctx->cmd_buff[sh->ctx->cmd_buff_pos - 1]; in z_shell_op_word_remove()
176 char *str_start = &sh->ctx->cmd_buff[0]; in z_shell_op_word_remove()
195 sh->ctx->cmd_buff_len - chars_to_delete); in z_shell_op_word_remove()
196 sh->ctx->cmd_buff_len -= chars_to_delete; in z_shell_op_word_remove()
197 sh->ctx->cmd_buff[sh->ctx->cmd_buff_len] = '\0'; in z_shell_op_word_remove()
209 z_shell_op_cursor_move(sh, -sh->ctx->cmd_buff_pos); in z_shell_op_cursor_home_move()
214 z_shell_op_cursor_move(sh, sh->ctx->cmd_buff_len - in z_shell_op_cursor_end_move()
215 sh->ctx->cmd_buff_pos); in z_shell_op_cursor_end_move()
220 if (sh->ctx->cmd_buff_pos > 0) { in z_shell_op_left_arrow()
227 if (sh->ctx->cmd_buff_pos < sh->ctx->cmd_buff_len) { in z_shell_op_right_arrow()
247 int len = strlen(&sh->ctx->cmd_buff[sh->ctx->cmd_buff_pos]); in reprint_from_cursor()
254 int line_len = sh->ctx->cmd_buff_len + z_shell_strlen(sh->ctx->prompt); in reprint_from_cursor()
255 int buff_pos = sh->ctx->cmd_buff_pos + z_shell_strlen(sh->ctx->prompt); in reprint_from_cursor()
257 if ((buff_pos / sh->ctx->vt100_ctx.cons.terminal_wid) != in reprint_from_cursor()
258 (line_len / sh->ctx->vt100_ctx.cons.terminal_wid)) { in reprint_from_cursor()
263 int pos = sh->ctx->cmd_buff_pos; in reprint_from_cursor()
266 if (buff_pos++ % sh->ctx->vt100_ctx.cons.terminal_wid == 0U) { in reprint_from_cursor()
270 sh->ctx->cmd_buff[pos++]); in reprint_from_cursor()
274 &sh->ctx->cmd_buff[sh->ctx->cmd_buff_pos]); in reprint_from_cursor()
277 sh->ctx->cmd_buff_pos = sh->ctx->cmd_buff_len; in reprint_from_cursor()
290 uint16_t after = sh->ctx->cmd_buff_len - sh->ctx->cmd_buff_pos; in data_insert()
291 char *curr_pos = &sh->ctx->cmd_buff[sh->ctx->cmd_buff_pos]; in data_insert()
293 if ((sh->ctx->cmd_buff_len + len) >= CONFIG_SHELL_CMD_BUFF_SIZE) { in data_insert()
299 sh->ctx->cmd_buff_len += len; in data_insert()
300 sh->ctx->cmd_buff[sh->ctx->cmd_buff_len] = '\0'; in data_insert()
303 sh->ctx->cmd_buff_pos += len; in data_insert()
312 sh->ctx->cmd_buff[sh->ctx->cmd_buff_pos++] = data; in char_replace()
330 (sh->ctx->cmd_buff_len != sh->ctx->cmd_buff_pos)) { in z_shell_op_char_insert()
339 if ((sh->ctx->cmd_buff_len == 0) || in z_shell_op_char_backspace()
340 (sh->ctx->cmd_buff_pos == 0)) { in z_shell_op_char_backspace()
350 uint16_t diff = sh->ctx->cmd_buff_len - sh->ctx->cmd_buff_pos; in z_shell_op_char_delete()
351 char *str = &sh->ctx->cmd_buff[sh->ctx->cmd_buff_pos]; in z_shell_op_char_delete()
358 --sh->ctx->cmd_buff_len; in z_shell_op_char_delete()
364 sh->ctx->cmd_buff_len = sh->ctx->cmd_buff_pos; in z_shell_op_delete_from_cursor()
365 sh->ctx->cmd_buff[sh->ctx->cmd_buff_pos] = '\0'; in z_shell_op_delete_from_cursor()
379 z_shell_multiline_data_calc(&sh->ctx->vt100_ctx.cons, in z_shell_cmd_line_erase()
380 sh->ctx->cmd_buff_pos, in z_shell_cmd_line_erase()
381 sh->ctx->cmd_buff_len); in z_shell_cmd_line_erase()
383 -(sh->ctx->vt100_ctx.cons.cur_x - 1)); in z_shell_cmd_line_erase()
384 z_shell_op_cursor_vert_move(sh, sh->ctx->vt100_ctx.cons.cur_y - 1); in z_shell_cmd_line_erase()
391 z_shell_fprintf(sh, SHELL_INFO, "%s", sh->ctx->prompt); in print_prompt()
398 int cmd_width = z_shell_strlen(sh->ctx->cmd_buff); in z_shell_print_cmd()
399 int adjust = sh->ctx->vt100_ctx.cons.name_len; in z_shell_print_cmd()
402 while (cmd_width > sh->ctx->vt100_ctx.cons.terminal_wid - adjust) { in z_shell_print_cmd()
403 end_offset += sh->ctx->vt100_ctx.cons.terminal_wid - adjust; in z_shell_print_cmd()
404 ch = sh->ctx->cmd_buff[end_offset]; in z_shell_print_cmd()
405 sh->ctx->cmd_buff[end_offset] = '\0'; in z_shell_print_cmd()
408 &sh->ctx->cmd_buff[beg_offset]); in z_shell_print_cmd()
410 sh->ctx->cmd_buff[end_offset] = ch; in z_shell_print_cmd()
411 cmd_width -= (sh->ctx->vt100_ctx.cons.terminal_wid - adjust); in z_shell_print_cmd()
417 &sh->ctx->cmd_buff[beg_offset]); in z_shell_print_cmd()
434 (sh->ctx->state < SHELL_STATE_PANIC_MODE_ACTIVE)) { in shell_pend_on_txdone()
435 k_event_wait(&sh->ctx->signal_event, SHELL_SIGNAL_TXDONE, false, K_FOREVER); in shell_pend_on_txdone()
436 k_event_clear(&sh->ctx->signal_event, SHELL_SIGNAL_TXDONE); in shell_pend_on_txdone()
463 (sh->ctx->state != SHELL_STATE_PANIC_MODE_ACTIVE)) { in z_shell_write()
487 (sh->ctx->vt100_ctx.col.bgcol == bgcolor)) { in vt100_bgcolor_set()
491 sh->ctx->vt100_ctx.col.bgcol = bgcolor; in vt100_bgcolor_set()
506 if (sh->ctx->vt100_ctx.col.col == color) { in z_shell_vt100_color_set()
510 sh->ctx->vt100_ctx.col.col = color; in z_shell_vt100_color_set()
535 (color != sh->ctx->vt100_ctx.col.col)) { in z_shell_vfprintf()
554 __ASSERT_NO_MSG(sh->ctx); in z_shell_fprintf()