jed-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Any outstanding issues?


SANGOI DINO LEONARDO wrote:
----
    |
hellOWORld!
[  TAB ]helLOWOrld!
hellOWORld!
       |
----

with the rectangle starting and ending at the character marked with '|'. The
uppercase characters will be selected.

As Jed stores TABs in Line, and the start/end selection are pointer to
inside the line, I can't mark put a start selection in the middle of a tab.

Maybe we can change the markers to be indexes to screen position, this means
changing a fair amount of code, and counting character cells to start the
selection at the right place... I will try it when I  have a little time...

I havent tried your code, I just remembered that you posted it a long time
ago. Here is how I think display of regions could work:

* Rectangular regions:
  enum {Normal, Rectangular, Line} mark_display_type;
  long mark_column;     // Filled when mark is set to Rectangular; what_column()
  long mark_line;
  long point_column;    // Filled when point moved in Rectangular mode; what_column()
  long point_line;

  mark_display_type, mark_column and mark_line could be part of Mark_Type;
  point_column and point_line can be replaced by what_column() and what_line()

* C meta code:
  display_line(*line)
  {
     ...
     if (mark_display_type == Rectangular)
     {
        // between(a,b) returns true for a, a+1, ... b-1, b (when a < b)
        if (LineNumber(line) between (mark_line, point_line))
        {
           (min, max) =
             intersect( (screen_first_col, screen_last_col), (mark_column, point_column) )
	   if (min >= screen_first_col && max <= screen_last_col)
           {
		hilight_line_region(min, max);
           }
        }
     }
     else if (mark_display_type == Line)
     {
        if (LineNumber(line) between (mark_line, point_line))
        {
           hilight_line_region(screen_first_col, screen_last_col);
        }
     }
     else
     {
        // current behaviour
     }
    ...
  }

Note that even without my patch copy/paste rectangles over a TAB has
problems: in the above example, pasting the rectangle gives:
----
owor
owor
----

the middle line has 4 spaces.

So the question is: how it is intended to work in if we have tabs?


IMO, this is the correct behaviour. If region start/end is in the middle
of a tab, the tab should be converted to spaces. Other tabs should be
left as they are, but this could also be a user setting: when copying
between buffers with different TAB size, it might better to convert tabs
to spaces.
An alternative is to also set TAB info for scrap buffer. Then
you can retain ALL TAB characters.

Marko

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]