Skip to content

Commit 03f4240

Browse files
Kevin MatochaKevin Matocha
authored andcommitted
updated code so the REPL will retain its text if not resized when code stops
1 parent b3f0668 commit 03f4240

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

shared-bindings/terminalio/Terminal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ STATIC mp_obj_t terminalio_terminal_make_new(const mp_obj_type_t *type, size_t n
6262
terminalio_terminal_obj_t *self = m_new_obj(terminalio_terminal_obj_t);
6363
self->base.type = &terminalio_terminal_type;
6464

65-
common_hal_terminalio_terminal_construct(self, tilegrid, font);
65+
common_hal_terminalio_terminal_construct(self, tilegrid, font, true);
6666
return MP_OBJ_FROM_PTR(self);
6767
}
6868

shared-bindings/terminalio/Terminal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
extern const mp_obj_type_t terminalio_terminal_type;
3535

3636
extern void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self,
37-
displayio_tilegrid_t *tilegrid, const fontio_builtinfont_t *font);
37+
displayio_tilegrid_t *tilegrid, const fontio_builtinfont_t *font, const bool reset_tiles);
3838

3939
// Write characters. len is in characters NOT bytes!
4040
extern size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self,

shared-module/displayio/display_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ bool displayio_display_core_show(displayio_display_core_t *self, displayio_group
169169
// force the circuit_python_splash out of any group (Note: could cause problems with the parent group)
170170
circuitpython_splash.x = 0; // reset position in case someone moved it.
171171
circuitpython_splash.y = 0;
172-
supervisor_stop_terminal();
172+
173173
supervisor_start_terminal(self->width, self->height);
174+
174175
root_group = &circuitpython_splash;
175176
}
176177
if (root_group == self->current_group) {

supervisor/shared/display.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
6161
#if CIRCUITPY_TERMINALIO
6262
displayio_tilegrid_t *grid = &supervisor_terminal_text_grid;
6363
bool tall = height_px > width_px;
64+
bool reset_tiles = false;
6465
uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width;
6566
uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px;
6667
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) {
8687
if (get_allocation_length(tilegrid_tiles) != align32_size(total_tiles)) {
8788
free_memory(tilegrid_tiles);
8889
tilegrid_tiles = NULL;
90+
reset_tiles = true;
8991
}
9092
}
9193
if (!tilegrid_tiles) {
9294
tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, true);
95+
reset_tiles = true;
9396
if (!tilegrid_tiles) {
9497
return;
9598
}
@@ -111,7 +114,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
111114
grid->tiles = tiles;
112115
grid->full_change = true;
113116

114-
common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font);
117+
common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font, reset_tiles);
115118
#endif
116119

117120
circuitpython_splash.scale = scale;

0 commit comments

Comments
 (0)