about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--029tools.cc10
-rw-r--r--080display.cc13
2 files changed, 20 insertions, 3 deletions
diff --git a/029tools.cc b/029tools.cc
index 1639ebba..706416a4 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -239,10 +239,14 @@ case _PRINT: {
   for (int i = 0; i < SIZE(ingredients); ++i) {
     if (is_literal(current_instruction().ingredients.at(i))) {
       trace(9998, "run") << "$print: " << current_instruction().ingredients.at(i).name << end();
-      if (has_property(current_instruction().ingredients.at(i), "newline"))
-        cout << '\n';
-      else
+      if (!has_property(current_instruction().ingredients.at(i), "newline")) {
         cout << current_instruction().ingredients.at(i).name;
+      }
+      // hack: '$print 10' prints '10', but '$print 10/newline' prints '\n'
+      // End $print 10/newline Special-cases
+      else {
+        cout << '\n';
+      }
     }
     else {
       for (int j = 0; j < SIZE(ingredients.at(i)); ++j) {
diff --git a/080display.cc b/080display.cc
index c05a4f99..2fcdfbf1 100644
--- a/080display.cc
+++ b/080display.cc
@@ -286,6 +286,19 @@ case MOVE_CURSOR_LEFT_ON_DISPLAY: {
   break;
 }
 
+//: as a convenience, make $print mostly work in console mode
+:(before "End $print 10/newline Special-cases")
+else if (tb_is_active()) {
+  move_cursor_to_start_of_next_line_on_display();
+}
+:(code)
+void move_cursor_to_start_of_next_line_on_display() {
+  if (Display_row < tb_height()-1) Display_row++;
+  Display_column = 0;
+  tb_set_cursor(Display_column, Display_row);
+  if (Autodisplay) tb_present();
+}
+
 :(before "End Primitive Recipe Declarations")
 DISPLAY_WIDTH,
 :(before "End Primitive Recipe Numbers")