Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 62 additions & 8 deletions src/terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,7 @@ void Terminal::insertInBuffer(const QString& chars)
}
}
else if(ch.toLatin1()=='\t') { //tab
if(cursorPos().y() <= iTabStops.size()) {
for(int i=0; i<iTabStops[cursorPos().y()-1].count(); i++) {
if(iTabStops[cursorPos().y()-1][i] > cursorPos().x()) {
setCursorPos(QPoint( iTabStops[cursorPos().y()-1][i], cursorPos().y() ));
break;
}
}
}
forwardTab();
}
else if(ch.toLatin1()==14 || ch.toLatin1()==15) { //SI and SO, related to character set... ignore
}
Expand Down Expand Up @@ -457,6 +450,30 @@ void Terminal::clearAll(bool wholeBuffer)
setCursorPos(QPoint(1,1));
}

void Terminal::backwardTab(void)
{
if(cursorPos().y() <= iTabStops.size()) {
for(int i=iTabStops[cursorPos().y()-1].count()-1; i>=0; i--) {
if(iTabStops[cursorPos().y()-1][i] < cursorPos().x()) {
setCursorPos(QPoint( iTabStops[cursorPos().y()-1][i], cursorPos().y() ));
break;
}
}
}
}

void Terminal::forwardTab(void)
{
if(cursorPos().y() <= iTabStops.size()) {
for(int i=0; i<iTabStops[cursorPos().y()-1].count(); i++) {
if(iTabStops[cursorPos().y()-1][i] > cursorPos().x()) {
setCursorPos(QPoint( iTabStops[cursorPos().y()-1][i], cursorPos().y() ));
break;
}
}
}
}


void Terminal::ansiSequence(const QString& seq)
{
Expand Down Expand Up @@ -609,6 +626,43 @@ void Terminal::ansiSequence(const QString& seq)
}
break;

case 'X':
if(!extra.isEmpty() || (params.count()>1)) {
unhandled=true;
break;
}
if (params.count()==0) {
params.append(1);
}
eraseLineAtCursor(cursorPos().x(),cursorPos().x()+(params.at(0)?params.at(0)-1:0));
break;

case 'I':
if(!extra.isEmpty() || (params.count()>1)) {
unhandled=true;
break;
}
if (params.count()==0) {
params.append(1);
}
for (int i=0;i<params.at(0);i++) {
forwardTab();
}
break;

case 'Z':
if(!extra.isEmpty() || (params.count()>1)) {
unhandled=true;
break;
}
if (params.count()==0) {
params.append(1);
}
for (int i=0;i<params.at(0);i++) {
backwardTab();
}
break;

case 'L': // insert lines
if(!extra.isEmpty()) {
unhandled=true;
Expand Down
4 changes: 3 additions & 1 deletion src/terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ class Terminal : public QObject
void resetTerminal();
void resetTabs();
void adjustSelectionPosition(int lines);

void forwardTab();
void backwardTab();

TextRender* iRenderer;
PtyIFace* iPtyIFace;
QQuickView* iWindow;
Expand Down