Forum > General

CRT unit kills Ctrl-C - SOLVED

<< < (2/3) > >>

MarkMLl:

--- Quote from: jollytall on June 05, 2023, 10:59:59 am ---As above I give up CRT for this purpose. Any other idea to "read" the cursor pos I would appreciate.

--- End quote ---

Short answer: there isn't one.

Longer answer: position relative to what? As soon as Crt has switched the terminal (as described by termcap/terminfo and manipulated by termios) back to the default mode it can scroll, so while you can generally work out where you are on a line any concept of vertical positioning is meaningless.

A library such as Crt will have its own internal state, which includes an indication of whether it's disabled scrolling and in (only) that case the physical Y position. The kernel will have its own internal state. A library such as (n)curses, used by e.g. the shell via termcap/terminfo, will have its own internal state: you /might/ be able to query this by sending it a carefully-crafted escape sequence but if used on an unexpected output device (see $TERM) you're screwed.

Quite frankly, if Crt does most of what you want it would be worth investigating and fixing its shortcomings. You might even find the core team grateful for it.

MarkMLl

Nitorami:
I wonder why you have the Ctrl-C problem only with unit CRT. Since windows 10, using Ctrl-C in a console program stopped working for me entirely, it just does nothing at all. I have tried options such as the "Legacy Mode" but in vain. I can only kill a not responding console, or, a bit less onerous, use Ctrl-Pause to kill the IDE and return to the command shell.

MarkMLl:

--- Quote from: Nitorami on June 05, 2023, 12:19:46 pm ---I wonder why you have the Ctrl-C problem only with unit CRT. Since windows 10, using Ctrl-C in a console program stopped working for me entirely, it just does nothing at all. I have tried options such as the "Legacy Mode" but in vain. I can only kill a not responding console, or, a bit less onerous, use Ctrl-Pause to kill the IDE and return to the command shell.

--- End quote ---

OP's explicitly said that he's using Linux.

MarkMLl

jollytall:
@Warfley: Thanks, it almost works.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---write(#27'[6n');read(s);gives back a string like

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---^[[9;1Rwhere 9 is the row (counting from the top of the screen) and 1 is the column. So, it works. Two problems:
- The reply string appears on the screen, though I would prefer it hidden.
- The read stops waiting for an enter (I tried writeLN and readLN in every combination, but it is the same).
How can I read the same string hidden and continue running?

@MarkMLI: Yes, it would be great to make CRT "smarter", but I am afraid my knowledge is far too little to improve it to an alternate screen, full escape sequence handling, signal handling, etc.

@Nitorami: As Mark also said, I on Linux, where Ctrl-C works well.


jollytall:
It seems to be much ado about nothing. Sorry for taking your time.

I just found ESC 7 and ESC 8 what saves the cursor position and restores it. So, I can easily store it before moving to the alternate window and restore it once I am back.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version