[Prev][Next][Index][Thread]

Deuce display problem and possible fix



When editing a file using the Deuce editor (either in the Functional
Developer IDE or standalone-deuce) there is a small re-display
problem.

The problem is when inserting text (a newline for example) before the
end of the file, causing the lines below it to move down. The last
line, if it is not pushed off the end of the window, redisplays merged
with the line before it. For example, a file with contents:

---------
line 1
line 2
line 3
line 4<eof>
---------

Where <eof> is end of file. Insert a new line before 'line 3' then
line 3 and line 4 will be moved down but will appear merged together
on one line. That is, both lines are displayed at the same 'y'
position.

If the file is:

---------
line 1
line 2
line 3
line 4
<eof>
---------

Then the problem does not appear as the merged line is empty. All
appears ok. I tracked the problem down to 'insert-display-lines' where
the <display-line> was not having its y position updated. Changing the
portions of 'insert-display-lines' to match the following fixes the
problem:

-------------------
  // Fix the Y positions of the lines we moved down,
  // unless they're off the bottom of the screen now
  block (return)
  without-bounds-checks
  for (i :: <integer> from index + n below n-slots,
       line = next //line-next-in-buffer(next, buffer, skip-test: #f)
       then line-next-in-buffer(line, buffer, skip-test: #f),
       while: line)
    let dline :: <display-line> = lines[i];
-------------------

The changed line is the one containing the '//line-next' comment. The
text after the '//' is what is originally there, I replaced it with
'next'. It's the 'next' display line that wasn't getting the update
'y' position. The call to 'line-next-in-buffer' returned #f as there
is no following line and the loop is not processed.

Any comments as to whether this is the right place to fix the problem
are appreciated.

Chris.
-- 
http://www.double.co.nz/dylan









Follow-Ups: