ansi_move_to Function

public pure function ansi_move_to(row, col) result(seq)

Move the cursor to a one-based row and column.

Numbers are converted with to_string, never with internal I/O: a write to an internal unit is not allowed in a pure procedure, and it would drag in locale-dependent formatting for no gain.

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: row

One-based row; values below 1 are clamped to 1.

integer(kind=default_int), intent(in) :: col

One-based column; values below 1 are clamped to 1.

Return Value character(len=:), allocatable


Calls

proc~~ansi_move_to~~CallsGraph proc~ansi_move_to ansi_move_to interface~to_string to_string proc~ansi_move_to->interface~to_string

Called by

proc~~ansi_move_to~~CalledByGraph proc~ansi_move_to ansi_move_to proc~frame_render frame_t%frame_render proc~frame_render->proc~ansi_move_to

Source Code

   pure function ansi_move_to(row, col) result(seq)
      !! Move the cursor to a one-based row and column.
      !!
      !! Numbers are converted with `to_string`, never with internal I/O: a
      !! `write` to an internal unit is not allowed in a `pure` procedure, and
      !! it would drag in locale-dependent formatting for no gain.
      integer(default_int), intent(in) :: row
         !! One-based row; values below 1 are clamped to 1.
      integer(default_int), intent(in) :: col
         !! One-based column; values below 1 are clamped to 1.
      character(len=:), allocatable :: seq

      seq = CSI//to_string(int(max(1_default_int, row), int32))//";"// &
            to_string(int(max(1_default_int, col), int32))//"H"
   end function ansi_move_to