First of all, you may want to modify it so that it doesn't try to change the window to a size not supported, instead of giving "bad parameter".
Whether it is valuable to change the size or not is a different matter. I kept it the way the original code was - the principle being "Make it work first - then change it around".
I have made changes - e.g. the way that lines are kept in memory as a linked list instead of as a big chunk of text (with binary line numbers in it) is a change from the original format. In a proper C++ solution, I think a std::map<int, string> would be the right solution, but linked list was easy to implement at the spur of a moment.