resolve todos

This commit is contained in:
Piotr Kocia 2025-03-31 18:19:08 +02:00
parent 602e6c1ebc
commit a168a78087
4 changed files with 21 additions and 29 deletions

27
ime.c
View file

@ -11,9 +11,9 @@
#include "log.h" #include "log.h"
#include "char32.h" #include "char32.h"
#include "render.h" #include "render.h"
#include "search.h"
#include "terminal.h" #include "terminal.h"
#include "util.h" #include "util.h"
#include "vimode.h"
#include "wayland.h" #include "wayland.h"
#include "xmalloc.h" #include "xmalloc.h"
@ -177,10 +177,8 @@ done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
ime_reset_preedit(seat); ime_reset_preedit(seat);
if (term != NULL) { if (term != NULL) {
if (term->vimode.active) if (term->vimode.searching)
// TODO (kociap): refresh render_refresh_vimode_search_box(term);
// render_refresh_search(term);
(void)0;
else else
render_refresh(term); render_refresh(term);
} }
@ -200,11 +198,9 @@ done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
size_t len = strlen(text); size_t len = strlen(text);
if (term != NULL) { if (term != NULL) {
if (term->vimode.active) { if (term->vimode.searching) {
// TODO (kociap): input and refresh vimode_search_add_chars(term, text, len);
// search_add_chars(term, text, len); render_refresh_vimode_search_box(term);
// render_refresh_search(term);
(void)0;
} else } else
term_to_slave(term, text, len); term_to_slave(term, text, len);
} }
@ -371,10 +367,8 @@ done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
ime_reset_pending_preedit(seat); ime_reset_pending_preedit(seat);
if (term != NULL) { if (term != NULL) {
if (term->vimode.active) if (term->vimode.searching)
// TODO (kociap): refresh render_refresh_vimode_search_box(term);
// render_refresh_search(term);
(void)0;
else else
render_refresh(term); render_refresh(term);
} }
@ -480,9 +474,8 @@ ime_update_cursor_rect(struct seat *seat)
goto update; goto update;
/* Set in render_search_box() */ /* Set in render_search_box() */
// TODO (kociap): in vimode this most likely is not necessary. if (term->vimode.searching)
// if (term->vimode.searching) goto update;
// goto update;
int x, y, width, height; int x, y, width, height;
int col = term->grid->cursor.point.col; int col = term->grid->cursor.point.col;

View file

@ -4,7 +4,7 @@
#define LOG_ENABLE_DBG 0 #define LOG_ENABLE_DBG 0
#include "log.h" #include "log.h"
#include "render.h" #include "render.h"
#include "search.h" #include "vimode.h"
void void
unicode_mode_activate(struct terminal *term) unicode_mode_activate(struct terminal *term)
@ -33,10 +33,8 @@ unicode_mode_updated(struct terminal *term)
{ {
if (term == NULL) if (term == NULL)
return; return;
if (term->vimode.active) if (term->vimode.searching)
// TODO (kociap): refresh render_refresh_vimode_search_box(term);
// render_refresh_search(term);
(void)0;
else else
render_refresh(term); render_refresh(term);
} }
@ -58,10 +56,8 @@ unicode_mode_input(struct seat *seat, struct terminal *term,
term->unicode_mode.character, (int)chars, utf8); term->unicode_mode.character, (int)chars, utf8);
if (chars != (size_t)-1) { if (chars != (size_t)-1) {
if (term->vimode.active) if (term->vimode.searching)
// TODO (kociap): input vimode_search_add_chars(term, utf8, chars);
// search_add_chars(term, utf8, chars);
(void)0;
else else
term_to_slave(term, utf8, chars); term_to_slave(term, utf8, chars);
} }

View file

@ -19,6 +19,7 @@
// TODO (kociap): consider adding scrolloff. // TODO (kociap): consider adding scrolloff.
// TODO (kociap): consider not cancelling selection on scroll. // TODO (kociap): consider not cancelling selection on scroll.
// TODO (kociap): jump list? // TODO (kociap): jump list?
// TODO (kociap): WORD motions.
static bool is_mode_visual(enum vi_mode const mode) { static bool is_mode_visual(enum vi_mode const mode) {
return mode == VI_MODE_VISUAL || mode == VI_MODE_VLINE || return mode == VI_MODE_VISUAL || mode == VI_MODE_VLINE ||
@ -724,7 +725,8 @@ static void add_wchars(struct terminal *term, char32_t *src, size_t count) {
term->vimode.search.buf[term->vimode.search.len] = U'\0'; term->vimode.search.buf[term->vimode.search.len] = U'\0';
} }
void search_add_chars(struct terminal *term, const char *src, size_t count) { void vimode_search_add_chars(struct terminal *term, const char *src,
size_t count) {
size_t chars = mbsntoc32(NULL, src, count, 0); size_t chars = mbsntoc32(NULL, src, count, 0);
if (chars == (size_t)-1) { if (chars == (size_t)-1) {
LOG_ERRNO("failed to convert %.*s to Unicode", (int)count, src); LOG_ERRNO("failed to convert %.*s to Unicode", (int)count, src);
@ -1513,7 +1515,7 @@ void vimode_input(struct seat *seat, struct terminal *term,
} }
if (count > 0) { if (count > 0) {
search_add_chars(term, (const char *)buf, count); vimode_search_add_chars(term, (const char *)buf, count);
render_refresh_vimode_search_box(term); render_refresh_vimode_search_box(term);
search_string_updated = true; search_string_updated = true;
} }

View file

@ -20,7 +20,8 @@ void vimode_input(struct seat *seat, struct terminal *term,
xkb_keysym_t sym, xkb_mod_mask_t mods, xkb_keysym_t sym, xkb_mod_mask_t mods,
xkb_mod_mask_t consumed, const xkb_keysym_t *raw_syms, xkb_mod_mask_t consumed, const xkb_keysym_t *raw_syms,
size_t raw_count, uint32_t serial); size_t raw_count, uint32_t serial);
// void search_add_chars(struct terminal *term, const char *text, size_t len); void vimode_search_add_chars(struct terminal *term, const char *text,
size_t len);
struct search_match_iterator { struct search_match_iterator {
struct terminal *term; struct terminal *term;