Skip to content

Commit ed88d10

Browse files
committed
(chore): minort touchups
1 parent 386c4f7 commit ed88d10

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

src/ffi/python/controllers.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use crate::api::Cursor;
12
use crate::api::TextChange;
23
use crate::api::controller::{AsyncReceiver, AsyncSender};
3-
use crate::api::{Cursor, Selection};
44
use crate::buffer::Controller as BufferController;
55
use crate::cursor::Controller as CursorController;
66
use pyo3::exceptions::PyValueError;
@@ -13,7 +13,7 @@ use super::a_sync_detach;
1313
#[pymethods]
1414
impl CursorController {
1515
#[pyo3(name = "send")]
16-
fn pysend(&self, _py: Python, pos: Selection) -> PyResult<()> {
16+
fn pysend(&self, _py: Python, pos: Cursor) -> PyResult<()> {
1717
self.send(pos)?;
1818
Ok(())
1919
}
@@ -142,11 +142,11 @@ impl Cursor {
142142

143143
#[getter(buffer)]
144144
fn pybuffer(&self) -> String {
145-
self.sel.iter().map(|s| s.buffer.clone()).collect()
145+
self.buffer.clone()
146146
}
147147

148-
#[getter(user)]
149-
fn pyuser(&self) -> Option<String> {
150-
Some(self.user.clone())
151-
}
148+
// #[getter(user)]
149+
// fn pyuser(&self) -> Option<String> {
150+
// Some(self.user.clone())
151+
// }
152152
}

src/ffi/python/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn tokio() -> &'static tokio::runtime::Runtime {
4848
// let _ = CREATE_FUTURE.get_or_init(|| create_future);
4949
// }
5050

51-
#[pyclass(from_py_object)]
51+
#[pyclass]
5252
pub struct Promise(Option<tokio::task::JoinHandle<PyResult<Py<PyAny>>>>);
5353

5454
#[pymethods]
@@ -121,7 +121,7 @@ impl std::io::Write for LoggerProducer {
121121
}
122122
}
123123

124-
#[pyclass(from_py_object)
124+
#[pyclass]
125125
pub struct Driver(Option<oneshot::Sender<()>>);
126126
#[pymethods]
127127
impl Driver {
@@ -231,13 +231,12 @@ impl Cursor {
231231
#[pymethods]
232232
impl Selection {
233233
#[new]
234-
#[pyo3(signature = (*, start_row, start_col, end_row, end_col, buffer, **kwds))]
234+
#[pyo3(signature = (*, start_row, start_col, end_row, end_col, **kwds))]
235235
pub fn py_new(
236236
start_row: i32,
237237
start_col: i32,
238238
end_row: i32,
239239
end_col: i32,
240-
buffer: String,
241240
kwds: Option<&Bound<'_, PyDict>>,
242241
) -> PyResult<Self> {
243242
if let Some(_kwds) = kwds {
@@ -246,15 +245,13 @@ impl Selection {
246245
start_col,
247246
end_row,
248247
end_col,
249-
buffer,
250248
})
251249
} else {
252250
Ok(Self {
253251
start_row,
254252
start_col,
255253
end_row,
256254
end_col,
257-
buffer,
258255
})
259256
}
260257
}

src/ffi/python/workspace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl Workspace {
2121
#[pyo3(name = "attach_buffer")]
2222
fn pyattach_buffer(&self, py: Python, path: String) -> PyResult<Promise> {
2323
let this = self.clone();
24-
a_sync_detach!(py, this.attach_buffer(path.as_str()).await)
24+
a_sync_detach!(py, this.attach_buffer(path).await)
2525
}
2626

2727
#[pyo3(name = "detach_buffer")]
@@ -32,20 +32,20 @@ impl Workspace {
3232
#[pyo3(name = "fetch_buffers")]
3333
fn pylist_buffers(&self, py: Python, filter: String) -> PyResult<Promise> {
3434
let this = self.clone();
35-
a_sync_detach!(py, this.list_buffers(filter.as_str()).await)
35+
a_sync_detach!(py, this.fetch_buffers(filter).await)
3636
}
3737

3838
#[pyo3(name = "fetch_users")]
3939
fn pylist_users(&self, py: Python) -> PyResult<Promise> {
4040
let this = self.clone();
41-
a_sync_detach!(py, this.list_users().await)
41+
a_sync_detach!(py, this.fetch_users().await)
4242
}
4343

4444
#[pyo3(name = "fetch_buffer_users")]
4545
fn pylist_buffer_users(&self, py: Python, path: String) -> PyResult<Promise> {
4646
// crate::Result<Vec<crate::api::User>>
4747
let this = self.clone();
48-
a_sync_detach!(py, this.list_buffer_users(path.as_str()).await)
48+
a_sync_detach!(py, this.fetch_buffer_users(path).await)
4949
}
5050

5151
#[pyo3(name = "delete_buffer")]

0 commit comments

Comments
 (0)