aboutsummaryrefslogtreecommitdiffstats
path: root/editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor.cpp')
-rw-r--r--editor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/editor.cpp b/editor.cpp
index 51b9077..08abdde 100644
--- a/editor.cpp
+++ b/editor.cpp
@@ -38,9 +38,18 @@ int Editor::run_editor() {
}
int Editor::print_contents_on_line(int line) const {
+ int output_length = m_contents->size();
+ bool truncated = false;
+ if ((int) m_contents->size() > line + OUTPUT_LINE_MAX) {
+ output_length = line + OUTPUT_LINE_MAX;
+ truncated = true;
+ }
for (int i = line; i < std::min((int) m_contents->size(), line + OUTPUT_LINE_MAX); i++) {
std::cout << i << " " << m_contents->at(i) << '\n';
}
+ if (truncated) {
+ std::cout << "...\n";
+ }
}
int Editor::edit_command() {