aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-06-07 22:40:46 +0100
committergingerBill <bill@gingerbill.org>2023-06-07 22:40:46 +0100
commit635842b322f3f12ed5a68f1dea4e3db45c0a3fee (patch)
tree7a25fe802150bf0d21c49766d2fc3fe558d7fa97
parent7dc09ed4501d0a7b256a05e6467cd86a262367ae (diff)
Add more text packages to `examples/all`
-rw-r--r--core/text/edit/text_edit.odin7
-rw-r--r--examples/all/all_main.odin6
2 files changed, 10 insertions, 3 deletions
diff --git a/core/text/edit/text_edit.odin b/core/text/edit/text_edit.odin
index c49a5d0d1..8520ba674 100644
--- a/core/text/edit/text_edit.odin
+++ b/core/text/edit/text_edit.odin
@@ -113,15 +113,16 @@ set_text :: proc(s: ^State, text: string) {
}
-undo_state_push :: proc(s: ^State, undo: ^[dynamic]^Undo_State) {
+undo_state_push :: proc(s: ^State, undo: ^[dynamic]^Undo_State) -> mem.Allocator_Error {
text := string(s.builder.buf[:])
- item := (^Undo_State)(mem.alloc(size_of(Undo_State) + len(text), align_of(Undo_State), s.undo_text_allocator))
+ item := (^Undo_State)(mem.alloc(size_of(Undo_State) + len(text), align_of(Undo_State), s.undo_text_allocator) or_return)
item.selection = s.selection
item.len = len(text)
#no_bounds_check {
runtime.copy(item.text[:len(text)], text)
}
- append(undo, item)
+ append(undo, item) or_return
+ return nil
}
undo :: proc(s: ^State, undo, redo: ^[dynamic]^Undo_State) {
diff --git a/examples/all/all_main.odin b/examples/all/all_main.odin
index 9515d2a00..07688cbc8 100644
--- a/examples/all/all_main.odin
+++ b/examples/all/all_main.odin
@@ -108,6 +108,9 @@ import sync "core:sync"
import testing "core:testing"
import scanner "core:text/scanner"
import i18n "core:text/i18n"
+import match "core:text/match"
+import table "core:text/table"
+import edit "core:text/edit"
import thread "core:thread"
import time "core:time"
@@ -210,6 +213,9 @@ _ :: sync
_ :: testing
_ :: scanner
_ :: i18n
+_ :: match
+_ :: table
+_ :: edit
_ :: thread
_ :: time
_ :: sysinfo