Set the frame’s dimensions, discarding the diff.
A resize invalidates the previous frame: the terminal has thrown away what was on screen, so nothing can be assumed still to be there.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(frame_t), | intent(inout) | :: | this | |||
| integer(kind=default_int), | intent(in) | :: | rows |
Number of lines; below 0 is treated as 0. |
||
| integer(kind=default_int), | intent(in) | :: | cols |
Width in code points; below 0 is treated as 0. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=default_int), | private | :: | c | ||||
| integer(kind=default_int), | private | :: | i | ||||
| integer(kind=default_int), | private | :: | r |
subroutine frame_resize(this, rows, cols) !! Set the frame's dimensions, discarding the diff. !! !! A resize invalidates the previous frame: the terminal has thrown away !! what was on screen, so nothing can be assumed still to be there. class(frame_t), intent(inout) :: this integer(default_int), intent(in) :: rows !! Number of lines; below 0 is treated as 0. integer(default_int), intent(in) :: cols !! Width in code points; below 0 is treated as 0. integer(default_int) :: r, c, i r = max(0_default_int, rows) c = max(0_default_int, cols) if (allocated(this%current)) deallocate (this%current) if (allocated(this%shown)) deallocate (this%shown) this%rows = r this%cols = c allocate (this%current(r)) allocate (this%shown(r)) do i = 1_default_int, r this%current(i) = "" this%shown(i) = "" end do this%full_redraw = .true. end subroutine frame_resize