emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Display problems with 'before-string in overlay


From: Lennart Borgman (gmail)
Subject: Re: Display problems with 'before-string in overlay
Date: Thu, 12 Apr 2007 21:47:10 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

Chong Yidong wrote:
"Lennart Borgman (gmail)" <address@hidden> writes:

      /* If the row ends with a newline from a string, we don't want
         the cursor there, but we still want it at the start of the
         string if the string starts in this row.
         If the row is continued it doesn't end in a newline.  */
      if (CHARPOS (row->end.string_pos) >= 0)
        cursor_row_p = (row->continued_p
                        ||
                        (
                         /* If an overlay string starts on this glyph
                            line, then put the cursor here, but only
                            if not on the first buffer line and there
                            are no characters there.  */
                         ((CHARPOS (row->start.string_pos)) == -1)
                         &&
                         ((CHARPOS (row->end.string_pos)) > -1)
                         &&
                         (row->start.pos.charpos > 1)
                         ));

This does not solve the underlying problem, because the unexpected
cursor position can occur even if the affected overlay is not on the
first line.

I trust you that it does not solve the underlying problem, but it works in my case and in the test case Kim supplied. That said I of course believe there can be problems with this solution, but I hope for your comments on that.


as can be seen from the fprintf output with my test case it starts
looping when I go to the first character and then press left arrow.

As you can see, tweaking redisplay can have rather non-trivial
effects.

Yes, I really believe it can, but I was wrong in this case. The problem is there without my changes. A new small bug.


Could you please tell me how then? I want to display text at the top
of a buffer, but I do not want to change the users text in the buffer.

Why not just use a header line?

Because I need several lines and I think it is rather necessary that they move together with the buffer contents to save screen estate.

I want to put this at the top of the buffer to make it easier for users to understand what is happening. This is part of nXhtml where I try to adopt James Clark's nxml-mode for editing of XHTML files and also files that are not full XHTML, like php, jsp etc.

The framework from nxml-mode parses the XML code in the buffer and gives the user the possibility to use completion of tags, attributes and values in accordance with the DTD. Now in the case of php this headers may not be there in the buffer (since they may instead be created dynamically) so I give the framework a starting state instead. To show the user the starting state I want to (optionally) show these lines in the buffer.

Even with this feedback it may be difficult to understand what is happening, but hopefully with it users will learn.

So at the top of the buffer I am displaying something like this with the help of an overlay and 'before-string:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <title>Dummy</title>
  </head>
  <body>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]