summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/state/editor/mod.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/state/editor/mod.rs b/src/state/editor/mod.rs
index d9c3ab5..3639226 100644
--- a/src/state/editor/mod.rs
+++ b/src/state/editor/mod.rs
@@ -3,7 +3,7 @@ use crate::cursor::CursorMove;
use self::{bar::EditorBarState, buffer::Buffer, cursorshape::CursorShape};
use super::{window::Window, GlobalState, DUMMY_STATE};
-use mlua::{Lua, Table, UserData};
+use mlua::{Lua, UserData};
pub mod bar;
pub mod buffer;
@@ -85,15 +85,8 @@ impl UserData for EditorState {
Ok(table)
});
- fields.add_field_function_set("lines", |_, _, content: Table| {
- let mut vec = Vec::new();
-
- for r in content.pairs::<usize, String>() {
- let (_, line) = r?;
- vec.push(line);
- }
-
- cfg_mut!().buffer.set_lines(vec);
+ fields.add_field_function_set("lines", |_, _, content: String| {
+ cfg_mut!().buffer.set_lines_from_string(content);
Ok(())
});