@@ -136,6 +136,30 @@ static mp_uint_t terminalio_terminal_write(mp_obj_t self_in, const void *buf_in,
136
136
return common_hal_terminalio_terminal_write (self , buf , size , errcode );
137
137
}
138
138
139
+ //| cursor_x: int
140
+ //| """The x position of the cursor."""
141
+ //|
142
+ static mp_obj_t terminalio_terminal_obj_get_cursor_x (mp_obj_t self_in ) {
143
+ terminalio_terminal_obj_t * self = MP_OBJ_TO_PTR (self_in );
144
+ return MP_OBJ_NEW_SMALL_INT (common_hal_terminalio_terminal_get_cursor_x (self ));
145
+ }
146
+ MP_DEFINE_CONST_FUN_OBJ_1 (terminalio_terminal_get_cursor_x_obj , terminalio_terminal_obj_get_cursor_x );
147
+
148
+ MP_PROPERTY_GETTER (terminalio_terminal_cursor_x_obj ,
149
+ (mp_obj_t )& terminalio_terminal_get_cursor_x_obj );
150
+
151
+ //| cursor_y: int
152
+ //| """The y position of the cursor."""
153
+ //|
154
+ static mp_obj_t terminalio_terminal_obj_get_cursor_y (mp_obj_t self_in ) {
155
+ terminalio_terminal_obj_t * self = MP_OBJ_TO_PTR (self_in );
156
+ return MP_OBJ_NEW_SMALL_INT (common_hal_terminalio_terminal_get_cursor_y (self ));
157
+ }
158
+ MP_DEFINE_CONST_FUN_OBJ_1 (terminalio_terminal_get_cursor_y_obj , terminalio_terminal_obj_get_cursor_y );
159
+
160
+ MP_PROPERTY_GETTER (terminalio_terminal_cursor_y_obj ,
161
+ (mp_obj_t )& terminalio_terminal_get_cursor_y_obj );
162
+
139
163
static mp_uint_t terminalio_terminal_ioctl (mp_obj_t self_in , mp_uint_t request , mp_uint_t arg , int * errcode ) {
140
164
terminalio_terminal_obj_t * self = MP_OBJ_TO_PTR (self_in );
141
165
mp_uint_t ret ;
@@ -155,6 +179,8 @@ static mp_uint_t terminalio_terminal_ioctl(mp_obj_t self_in, mp_uint_t request,
155
179
static const mp_rom_map_elem_t terminalio_terminal_locals_dict_table [] = {
156
180
// Standard stream methods.
157
181
{ MP_ROM_QSTR (MP_QSTR_write ), MP_ROM_PTR (& mp_stream_write_obj ) },
182
+ { MP_ROM_QSTR (MP_QSTR_cursor_x ), MP_ROM_PTR (& terminalio_terminal_cursor_x_obj ) },
183
+ { MP_ROM_QSTR (MP_QSTR_cursor_y ), MP_ROM_PTR (& terminalio_terminal_cursor_y_obj ) },
158
184
};
159
185
static MP_DEFINE_CONST_DICT (terminalio_terminal_locals_dict , terminalio_terminal_locals_dict_table ) ;
160
186
@@ -168,7 +194,7 @@ static const mp_stream_p_t terminalio_terminal_stream_p = {
168
194
MP_DEFINE_CONST_OBJ_TYPE (
169
195
terminalio_terminal_type ,
170
196
MP_QSTR_Terminal ,
171
- MP_TYPE_FLAG_ITER_IS_ITERNEXT ,
197
+ MP_TYPE_FLAG_ITER_IS_ITERNEXT | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS ,
172
198
make_new , terminalio_terminal_make_new ,
173
199
locals_dict , (mp_obj_dict_t * )& terminalio_terminal_locals_dict ,
174
200
iter , mp_stream_unbuffered_iter ,
0 commit comments