about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--020run.cc6
-rw-r--r--029tools.cc20
-rw-r--r--070display.cc9
-rw-r--r--071print.mu2
-rw-r--r--edit.mu12
-rw-r--r--termbox/termbox.c4
6 files changed, 45 insertions, 8 deletions
diff --git a/020run.cc b/020run.cc
index 07526235..b04fa90a 100644
--- a/020run.cc
+++ b/020run.cc
@@ -156,9 +156,9 @@ if (argc > 1) {
 :(before "End Main")
 if (!Run_tests) {
   setup();
-//?   Trace_file = "interactive"; //? 2
-//?   START_TRACING_UNTIL_END_OF_SCOPE; //? 2
-//?   Trace_stream->collect_layer.insert("app"); //? 1
+//?   Trace_file = "interactive"; //? 3
+//?   START_TRACING_UNTIL_END_OF_SCOPE; //? 3
+//?   Trace_stream->collect_layers.insert("app"); //? 2
   transform_all();
   recipe_ordinal r = Recipe_ordinal[string("main")];
 //?   atexit(dump_profile); //? 1
diff --git a/029tools.cc b/029tools.cc
index 12840d90..232c484b 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -260,3 +260,23 @@ case _DUMP_MEMORY: {
   dump_memory();
   break;
 }
+
+:(before "End Primitive Recipe Declarations")
+_LOG,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$log"] = _LOG;
+:(before "End Primitive Recipe Implementations")
+case _LOG: {
+//?   ofstream fout("log", ofstream::app);
+//?   for (long long int i = 0; i < SIZE(current_instruction().ingredients); ++i) {
+//?     fout << print_mu(current_instruction().ingredients.at(i), ingredients.at(i));
+//?   }
+//?   fout << '\n';
+//?   fout.close();
+  ostringstream out;
+  for (long long int i = 0; i < SIZE(current_instruction().ingredients); ++i) {
+    out << print_mu(current_instruction().ingredients.at(i), ingredients.at(i));
+  }
+  trace(1, "app") << out.str() << end();
+  break;
+}
diff --git a/070display.cc b/070display.cc
index c8474900..2429f42d 100644
--- a/070display.cc
+++ b/070display.cc
@@ -50,6 +50,7 @@ Recipe_ordinal["clear-display"] = CLEAR_DISPLAY;
 case CLEAR_DISPLAY: {
   tb_clear();
   Display_row = Display_column = 0;
+//?   tb_present();
   break;
 }
 
@@ -103,6 +104,10 @@ case PRINT_CHARACTER_TO_DISPLAY: {
     bg_color = ingredients.at(2).at(0);
     if (bg_color == 0) bg_color = TB_BLACK;
   }
+//?   ofstream fout("log", ofstream::app);
+//?   fout << "displaying at " << Display_row << ", " << Display_column << ": " << (int)c << " in color " << color << ", " << bg_color << '\n';
+//?   fout.close();
+  trace(1, "app") << "displaying at " << Display_row << ", " << Display_column << ": " << (int)c << " in color " << color << ", " << bg_color << end();
   tb_change_cell(Display_column, Display_row, c, color, bg_color);
   if (c == '\n' || c == '\r') {
     if (Display_row < height-1) {
@@ -114,6 +119,10 @@ case PRINT_CHARACTER_TO_DISPLAY: {
     break;
   }
   if (c == '\b') {
+//?     ofstream fout("log", ofstream::app);
+//?     fout << "handling backspace\n";
+//?     fout.close();
+    trace(1, "app") << "handling backspace" << end();
     if (Display_column > 0) {
       tb_change_cell(Display_column-1, Display_row, ' ', color, bg_color);
       --Display_column;
diff --git a/071print.mu b/071print.mu
index 9732ce2f..ddaa3d1c 100644
--- a/071print.mu
+++ b/071print.mu
@@ -102,6 +102,7 @@ recipe print-character [
     bg-color <- copy 0/black
   }
   trace 90, [print-character], c
+  $log [printing character] c
   {
     # if x exists
     # (handle special cases exactly like in the real screen)
@@ -392,6 +393,7 @@ recipe move-cursor [
     reply sc/same-as-ingredient:0
   }
   # otherwise, real screen
+  $log [moving cursor to] new-row new-column
   move-cursor-on-display new-row, new-column
   reply sc/same-as-ingredient:0
 ]
diff --git a/edit.mu b/edit.mu
index 2bacfebd..b0a24383 100644
--- a/edit.mu
+++ b/edit.mu
@@ -1600,7 +1600,8 @@ recipe delete-before-cursor [
     loop
   }
   # we're guaranteed not to be at the right margin
-  screen <- print-character screen, 32/space
+  $log [printing space for backspace]
+#?   screen <- print-character screen, 32/space
   reply editor/same-as-ingredient:0, screen/same-as-ingredient:1, 0/no-more-render
 ]
 
@@ -4774,8 +4775,10 @@ recipe render-all [
   local-scope
   screen:address <- next-ingredient
   env:address:programming-environment-data <- next-ingredient
+  $log [--- render all]
   hide-screen screen
   # top menu
+  $log [-- top menu]
   width:number <- screen-width screen
   draw-horizontal screen, 0, 0/left, width, 32/space, 0/black, 238/grey
   button-start:number <- subtract width, 20
@@ -4785,6 +4788,7 @@ recipe render-all [
   run-button:address:array:character <- new [ run (F4) ]
   print-string screen, run-button, 255/white, 161/reddish
   # error message
+  $log [-- status]
   recipe-warnings:address:array:character <- get *env, recipe-warnings:offset
   {
     break-unless recipe-warnings
@@ -4792,6 +4796,7 @@ recipe render-all [
     update-status screen, status, 1/red
   }
   # dotted line down the middle
+  $log [-- vertical line]
   divider:number, _ <- divide-with-remainder width, 2
   height:number <- screen-height screen
   draw-vertical screen, divider, 1/top, height, 9482/vertical-dotted
@@ -4837,6 +4842,7 @@ recipe render-recipes [
   local-scope
   screen:address <- next-ingredient
   env:address:programming-environment-data <- next-ingredient
+  $log [-- render recipes]
   recipes:address:editor-data <- get *env, recipes:offset
   # render recipes
   left:number <- get *recipes, left:offset
@@ -4891,6 +4897,9 @@ after +global-type [
   {
     ctrl-l?:boolean <- equal *c, 12/ctrl-l
     break-unless ctrl-l?
+    $log [=== ctrl-l pressed]
+#?     screen <- clear-screen screen
+    clear-display
     screen <- render-all screen, env:address:programming-environment-data
     loop +next-event:label
   }
@@ -5245,6 +5254,7 @@ recipe render-sandbox-side [
   local-scope
   screen:address <- next-ingredient
   env:address:programming-environment-data <- next-ingredient
+  $log [-- render sandbox side]
 #?   trace 10, [app], [render sandbox side] #? 1
   current-sandbox:address:editor-data <- get *env, current-sandbox:offset
   left:number <- get *current-sandbox, left:offset
diff --git a/termbox/termbox.c b/termbox/termbox.c
index d8cc4514..c9ea6012 100644
--- a/termbox/termbox.c
+++ b/termbox/termbox.c
@@ -181,10 +181,6 @@ void tb_present(void)
       front = &CELL(&front_buffer, x, y);
       w = wcwidth(back->ch);
       if (w < 1) w = 1;
-      if (memcmp(back, front, sizeof(struct tb_cell)) == 0) {
-        x += w;
-        continue;
-      }
       memcpy(front, back, sizeof(struct tb_cell));
       send_attr(back->fg, back->bg);
       if (w > 1 && x >= front_buffer.width - (w - 1)) {