Browse Source

fix(lua): Bind missing EditorCore cursor and movement methods

- Added 'cursor' property binding (read/write).
- Added bindings for movement methods: move_up, move_down, move_left, move_right, move_to_line_start, move_to_line_end, move_forward_word, move_backward_word.
- This fixes crashes and nil errors when loading default Lua configuration which relies on these methods.
Bernardo Magri 1 month ago
parent
commit
dc46d6802f
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/lua_api.cpp

+ 11 - 0
src/lua_api.cpp

@@ -659,6 +659,17 @@ void LuaApi::register_types() {
     lua_.new_usertype<EditorCore>("EditorCore",
         sol::no_constructor,
 
+        "cursor", sol::property(&EditorCore::cursor, &EditorCore::set_cursor), // Added cursor property
+        
+        // Movement
+        "move_up", &EditorCore::move_up,
+        "move_down", &EditorCore::move_down,
+        "move_left", &EditorCore::move_left,
+        "move_right", &EditorCore::move_right,
+        "move_to_line_start", &EditorCore::move_to_line_start,
+        "move_to_line_end", &EditorCore::move_to_line_end,
+        "move_forward_word", &EditorCore::move_forward_word,
+        "move_backward_word", &EditorCore::move_backward_word,
 
         "page_up", &EditorCore::page_up,
         "page_down", &EditorCore::page_down,