Skip to content

Possible differences between the VT330 and VT340 when using multiple aspect ratios #37

@j4james

Description

@j4james

When testing Sixel images with multiple aspect ratios on a VT330, I noticed some interesting side effects.

  1. If the aspect ratio changes partway through a row, the x offset seems to be set back to the start of the row.
  2. Depending on what operations have been performed with the previous aspect ratio, the new aspect ratio will not necessarily apply to a DECGNL that follows it.

The script below demonstrates some of these effects.

multiple_aspect_ratio.sh
#!/bin/bash

# Test the effects of multiple aspect ratios in a Sixel image.

# The first set of tests demonstrate the effect of a new aspect ratio
# on the following graphic new line (DECGNL) commands.
# The second set of tests demonstrate the effect of a new aspect ratio
# on the x offset, when not already at the start of a line.

CSI=$'\e['			# Control Sequence Introducer 
DCS=$'\eP'			# Device Control String
ST=$'\e\\'			# String Terminator


echo -n ${CSI}'H'
echo -n ${CSI}'2J'
echo -n ${CSI}'?5l'

set_cursor_pos() {
  echo -n ${CSI}${1}';'${2}'H'
}

new_line_test() {
  local row=${1}
  local col=${2}
  local prefix=${3}
  local suffix=${4}

  set_cursor_pos ${row} ${col}
  echo -n ${DCS}'9;0q'
  echo -n '"10;1;1;1'	# Start with 10:1 aspect ratio
  echo -n '#1!60~'	# Render 60x60 block
  echo -n ${prefix}	# Output the prefix value
  echo -n '"5;1;1;1'	# Change aspect ratio to 5:1
  echo -n ${suffix}	# Output the suffix value
  echo -n '-'		# Move to new line
  echo -n '"1;1;1;1'	# Change aspect ratio to 1:1
  echo -n '#2!90`'	# Output marker lines to show how far we moved
  echo -n ${ST}
  echo -en '\b\b>'
}

auto_return_test() {
  local row=${1}
  local col=${2}
  local ar=${3}

  set_cursor_pos ${row} ${col}
  echo -n ${DCS}'9;0q'
  echo -n '"10;1;1;1'	# Start with 10:1 aspect ratio
  echo -n '#1!30~'	# Render 30x60 block
  echo -n '"'${ar}';1;1' # Change aspect ratio
  echo -n '#2!60`'	# Output marker lines to show the carriage return
  echo -n ${ST}
  echo -en '\b\b>'
}

new_line_test 4  5  ''  ''
new_line_test 4  18 '+' ''
new_line_test 4  31 '-' ''
new_line_test 4  44 '$' ''
new_line_test 4  57 ''  '$'
new_line_test 4  70 ''  '#3'
new_line_test 12 5  ''  '0'
new_line_test 12 18 ''  '+'
new_line_test 12 31 ''  '-'
new_line_test 12 44 ''  '?'
new_line_test 12 57 ''  '!1'
new_line_test 12 70 ''  '"'

auto_return_test 20 5  '5;1'
auto_return_test 20 18 '10;1'
auto_return_test 20 31 '5;0'
auto_return_test 20 44 ';'
auto_return_test 20 57 ';1'
auto_return_test 20 70 '0;1'

echo -n ${CSI}'H'

I'm not positive, but I suspect the VT340 doesn't work the same way, so I'm curious to see what output you get from this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions