Skip to main content
better link
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290

XTerm Control SequencesXTerm Control Sequences documents the relevant escape sequence:

XTerm Control Sequences documents the relevant escape sequence:

XTerm Control Sequences documents the relevant escape sequence:

clarify
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290

That part with the cursor position report doesn't seem as if it would work in (for example) a readline binding, so I suggested a script. You could make a binding that used the save/restore cursor capabilities if there were not the problem of being on the first line.

That part with the cursor position report doesn't seem as if it would work in (for example) a readline binding, so I suggested a script.

That part with the cursor position report doesn't seem as if it would work in (for example) a readline binding, so I suggested a script. You could make a binding that used the save/restore cursor capabilities if there were not the problem of being on the first line.

clarify
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290

If you wanted to "clear above", that is not as straightforward as typing "clear". The escape \033[1J erases from the upper-left to the current cursor position. You could make a script which does this, to clear only the lines above your current cursor:

  • use the cursor position report to find the row/column on which the cursor currently is, and
  • if the cursor is not on the first line, (saving that position), move the cursor up one line and then (with the hpa sequence) move right a large number,
  • issue the "clear above", and
  • return to the original position using cup (cursor addressing).

That part with the cursor position report doesn't seem as if it would work in (for example) a readline binding, so I suggested a script.

If you wanted to "clear above", that is not as straightforward as typing "clear". The escape \033[1J erases from the upper-left to the current cursor position. You could make a script which does this, to clear only the lines above your current cursor:

  • use the cursor position report to find the row/column on which the cursor currently is, and
  • if the cursor is not on the first line, (saving that position), move the cursor up one line and then (with the hpa sequence) move right a large number,
  • issue the "clear above", and
  • return to the original position using cup (cursor addressing).

That part with the cursor position report doesn't seem as if it would work in (for example) a readline binding, so I suggested a script.

clarify
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290
Loading
clarify
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290
Loading
clarify
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290
Loading
clarify
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290
Loading
Source Link
Thomas Dickey
  • 79.3k
  • 9
  • 189
  • 290
Loading