fix incorrect restriction of value committing in watch views; only commit value if initial value of edited text was unchanged

This commit is contained in:
Ryan Fleury
2025-01-05 22:46:08 -08:00
parent bc44f58a80
commit fb1fb6b014
+5 -1
View File
@@ -1738,6 +1738,9 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
// rjf: commit edited cell string // rjf: commit edited cell string
Vec2S64 tbl = v2s64(x, y); Vec2S64 tbl = v2s64(x, y);
RD_WatchViewColumn *col = rd_watch_view_column_from_x(ewv, x); RD_WatchViewColumn *col = rd_watch_view_column_from_x(ewv, x);
String8 initial_string = str8(edit_state->initial_buffer, edit_state->initial_size);;
if(!str8_match(new_string, initial_string, 0))
{
switch(col->kind) switch(col->kind)
{ {
default:{}break; default:{}break;
@@ -1779,7 +1782,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
} }
else if(evt->slot != UI_EventActionSlot_Cancel) else if(evt->slot != UI_EventActionSlot_Cancel)
{ {
should_commit_asap = 0; should_commit_asap = editing_complete;
} }
if(should_commit_asap) if(should_commit_asap)
{ {
@@ -1822,6 +1825,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
} }
} }
} }
}
if(editing_complete) if(editing_complete)
{ {
ewv->text_editing = 0; ewv->text_editing = 0;