Canvas is not repainted after chunk is added or deleted

RESOLVED FIXED in 0.2.x

Status

Skywriter
Editor
P1
minor
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: Jacques Belissent, Unassigned)

Tracking

Details

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.9
Build Identifier: 0.2.1

Windows Vista, FF 3.0.9

When I select a chunk of code then remove it using backspace, the editor does not show the expected result until I use the keyboard to move the cursor or type other characters.

Reproducible: Always

Steps to Reproduce:
1.select one line of code
2.remove it using backspace

Actual Results:  
the line below the removed line is duplicated, taking the place of the deleted one, but the code is not translated upwards.

this get back to normal as soon as I move the cursor.
This is still happening on trunk, so confirming.
Severity: major → minor
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows Vista → All
Hardware: x86 → All
Summary: code is not immediately modified when a chunk is added or removed → Canvas is not repainted after deletion of a full line
Version: unspecified → Trunk
(Reporter)

Updated

9 years ago
Severity: minor → major
OS: All → Windows Vista
Hardware: All → x86
Summary: Canvas is not repainted after deletion of a full line → code is not immediately modified when a chunk is added or removed
Version: Trunk → 0.2.1
There is a reason I changed the fields that I did. Please do not change them back unnecessarily.
Severity: major → minor
OS: Windows Vista → All
Hardware: x86 → All
Summary: code is not immediately modified when a chunk is added or removed → Canvas is not repainted after chunk is added or deleted
Version: 0.2.1 → Trunk
(Reporter)

Comment 3

9 years ago
Shameless workaround:  delaying the repaint a bit seems to get things in order
most of the time (not all the time).  Please scream is you know of a regression this hack would
cause.

$ svn diff actions.js
Index: actions.js
===================================================================
--- actions.js  (revision 8842)
+++ actions.js  (working copy)
@@ -422,7 +422,7 @@
             pos =
this.model.insertChunk(this.cursorManager.getModelPosition(po
s), args.chunk);
             pos = this.cursorManager.getCursorPosition(pos);
             this.cursorManager.moveCursor(pos);
-            this.repaint();
+            this.repaint(true);

             // undo/redo
             args.action = "insertChunk";
@@ -502,7 +502,7 @@
         // setting the selection to undefined has to happen *after* we enqueue
the undoOp otherwise replay breaks
         this.editor.setSelection(undefined);
         this.cursorManager.moveCursor(selection.startPos);
-        this.repaint();
+        this.repaint(true);

         return chunk;
     },
@@ -876,10 +876,14 @@
         }
     },

-    repaint: function() {
+    repaint: function(delay) {
         if (!this.ignoreRepaints) {
-            this.editor.ui.ensureCursorVisible();
-            this.editor.paint();
-        }
+                       if (delay) {
+                               setTimeout(dojo.hitch(this, function()
{this.repaint();}), 1);
+                               setTimeout(dojo.hitch(this, function()
{this.repaint();}), 100);
+                       } else {
+                               this.editor.ui.ensureCursorVisible();
+                               this.editor.paint();
+                       }
+               }
     }
 });

Comment 4

9 years ago
Jacques,

thank you for joining the bespin project :)

one thing: for the futur could you add patches as attachments to the bugreport? This keeps it from getting "overfilled".

I looked at the issue you describes and found out, that it is based in the fact the model's rowMetadata's cache not taking in account if rows get splittend and joined again.

I fixed this in http://bitbucket.org/j4c/bespin/changeset/f018f24b5dd2/. Anyone to pull from there to the main tip?

Julian

Comment 5

9 years ago
THanks Julian! Applied.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Priority: -- → P1
Resolution: --- → FIXED
Target Milestone: --- → 0.2.x
(Reporter)

Comment 6

9 years ago
line insertion is fixed.  However, the problem remains on line deletion.

I wonder if this.cacheRowMetadata should be also updated in other cases in which rows is modified, like in the deleteRows method.

Comment 7

9 years ago
I fixed the missing deleteRows handling for the rowMetadata in http://bitbucket.org/j4c/bespin/changeset/6164e4c74503/.

Added support for scrolling only one line there as well; just go and pull everything from the repo.

Julian
You need to log in before you can comment on or make changes to this bug.