0

What is the key output difference between Active data position and Active presentation position defined separately in ECMA-48 in 4.2.5 and 4.2.6 ?

I tried to move my cursor to a different coordinate in the console with Escape Sequences defined in ECMA-48.

And I encountered two implementations doing the same thing but actually telling something different in the definitions.

According to the definitions:

CUP

CUP causes the active presentation position to be moved in the presentation component ...

HVP

HVP causes the active data position to be moved in the data component ...

When tested with C code:

CUP:

printf("Hello");
printf("\x1b" "[" "%d" ";" "%d" "H", 5, 5);
printf("World");

HVP:

printf("Hello");
printf("\x1b" "[" "%d" ";" "%d" "f", 5, 5);
printf("World");

They produce the same results.

So, whats the difference that the standard is trying to make by defining these two terms?

EDIT :

According to 6.1.5,

In a uni-directional device, whether it has a presentation component only or a presentation component and a data component, there is no difference between the active data position and the active presentation position.

And in page 16 (6.1.5), in the first paragrpah:

Because of the possible differences between character progression and character path, as in some bi-directional environments, the coordinates of the active data position in the data component and of the active presentation position in the presentation component may differ.

Explain Active Presentation Position and Active Data Position in a Bi-directional Environments with Practical Example.

And, which one should I use to move around the console?

[N.B: Don't mention to use ncurses in your recommendation. But any recommendation on Implementation of ECMA-48 is welcomed]

Noman
  • 124
  • 2
  • 9
  • From what I remember from the old days (>30 years ago) I used `"\x1b" "[" "%d" ";" "%d" "H"` for positionning the cursor. BTW: I'd rather write this like this `printf("\x1b[%d;%dH", 5, 5);` – Jabberwocky Feb 05 '19 at 10:13
  • @Jabberwocky what kind of shell you used back then? – Noman Feb 05 '19 at 12:54
  • No shell, but directly outputting escape sequences from pascal programs on a VT100 terminal connected to an antiquated minicomputer (Norsk Data). – Jabberwocky Feb 05 '19 at 12:59

1 Answers1

0

As it says: for a uni-directional device there is no difference. You'd have to investigate a bi-directional device (and have the corresponding modes enabled).

It's referring to a device where the cursor could be made to advance after the terminal printed a character in some other way than left-to-right, wrapping top-to-bottom. You can see something like this in a GUI web browser visiting a page that's in Arabic: text goes from right-to-left, but you can have text components embedded in it which are written from left-to-right. The data- and presentation positions are used to keep that mixture straight. (If there's no mixture, it's a trivial problem, but accordingly of little interest).

VT100s never did that. The last of DEC's terminals in the early/mid-1990s, the VT520 did not (it's likely that no widely used terminal supported bi-directional controls). Although there was an HVP in ECMA-48 2nd edition (August 1979), the wording about direction was added in the 4th edition (December 1986). It was revised somewhat for the 5th edition (June 1991).

A few terminal emulators can do this, but lacking a hardware terminal (which would have demonstrated the features which the members of the committee who wrote the documents had in mind), there are differences and disagreements over the interpretation.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Can you tell whether the modern linux terminals or terminal emulators like bash, zsh, cmd, powershell are bi-directional or not? – Noman Feb 06 '19 at 06:53
  • It's not a matter of "modern" (a commonly-misused term). BIDI in konsole and mlterm is much older than this forum. The programs you mention are not terminal emulators, nor are they "modern". – Thomas Dickey Feb 06 '19 at 09:17
  • My bad, do these shells or command line interpreters or any of linux consoles are bi-directional or not? (I am actually trying to say the command line *things* that we normally regularly use) – Noman Feb 06 '19 at 13:08
  • konsole and mlterm run on Linux (and more, since they're moderately portable). – Thomas Dickey Feb 06 '19 at 21:28