Skip to content

Instantly share code, notes, and snippets.

@Qix-
Created April 15, 2016 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qix-/6f659c6b7e7217dca020be47a22fd085 to your computer and use it in GitHub Desktop.
Save Qix-/6f659c6b7e7217dca020be47a22fd085 to your computer and use it in GitHub Desktop.
Skinnify
#include <iostream>
#include <string>
#include <deque>
using namespace std;
int main(int argc, char **argv) {
if (argc < 2) return 1;
int backsize = atoi(argv[1]);
deque<string> backlog(backsize, "");
cout << string(backsize, '\n');
string line;
while (getline(cin, line)) {
backlog.pop_front();
backlog.push_back(line);
cout << "\x1b[G\x1b[" << backsize << "A";
for (string s : backlog) cout << "\x1b[K" << s << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment