updated code so the REPL will retain its text if not resized when code stops
This commit is contained in:
parent
b3f06688d3
commit
03f42406d3
@ -62,7 +62,7 @@ STATIC mp_obj_t terminalio_terminal_make_new(const mp_obj_type_t *type, size_t n
|
||||
terminalio_terminal_obj_t *self = m_new_obj(terminalio_terminal_obj_t);
|
||||
self->base.type = &terminalio_terminal_type;
|
||||
|
||||
common_hal_terminalio_terminal_construct(self, tilegrid, font);
|
||||
common_hal_terminalio_terminal_construct(self, tilegrid, font, true);
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
extern const mp_obj_type_t terminalio_terminal_type;
|
||||
|
||||
extern void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self,
|
||||
displayio_tilegrid_t *tilegrid, const fontio_builtinfont_t *font);
|
||||
displayio_tilegrid_t *tilegrid, const fontio_builtinfont_t *font, const bool reset_tiles);
|
||||
|
||||
// Write characters. len is in characters NOT bytes!
|
||||
extern size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self,
|
||||
|
@ -169,8 +169,9 @@ bool displayio_display_core_show(displayio_display_core_t *self, displayio_group
|
||||
// force the circuit_python_splash out of any group (Note: could cause problems with the parent group)
|
||||
circuitpython_splash.x = 0; // reset position in case someone moved it.
|
||||
circuitpython_splash.y = 0;
|
||||
supervisor_stop_terminal();
|
||||
|
||||
supervisor_start_terminal(self->width, self->height);
|
||||
|
||||
root_group = &circuitpython_splash;
|
||||
}
|
||||
if (root_group == self->current_group) {
|
||||
|
@ -61,6 +61,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
displayio_tilegrid_t *grid = &supervisor_terminal_text_grid;
|
||||
bool tall = height_px > width_px;
|
||||
bool reset_tiles = false;
|
||||
uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width;
|
||||
uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px;
|
||||
uint16_t width_in_tiles = terminal_width_px / grid->tile_width;
|
||||
@ -86,10 +87,12 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
|
||||
if (get_allocation_length(tilegrid_tiles) != align32_size(total_tiles)) {
|
||||
free_memory(tilegrid_tiles);
|
||||
tilegrid_tiles = NULL;
|
||||
reset_tiles = true;
|
||||
}
|
||||
}
|
||||
if (!tilegrid_tiles) {
|
||||
tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, true);
|
||||
reset_tiles = true;
|
||||
if (!tilegrid_tiles) {
|
||||
return;
|
||||
}
|
||||
@ -111,7 +114,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
|
||||
grid->tiles = tiles;
|
||||
grid->full_change = true;
|
||||
|
||||
common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font);
|
||||
common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font, reset_tiles);
|
||||
#endif
|
||||
|
||||
circuitpython_splash.scale = scale;
|
||||
|
Loading…
Reference in New Issue
Block a user