[BUG] Disappearing of first line after Ctrl-Y

Andrew V. Samoilov sav at bcs.zp.ua
Wed Nov 6 17:41:22 UTC 2002


Dmitry Semyonov wrote:
> Hello, Pavel.
> 
> The patch for edit.c that fixes all the discribed problems is attached.
> At the same time I think that 'Ctrl-Y F3' related bug was just shaded
> out but not fixed.

At first your patch cannot be applied clearly because it is in DOS 
format (carriage return before newline).  Also I cannot understand, why 
you replace tabulation with spaces. It will be fine if you will use 
indent -kr -i4 -psl -pcs for each function you change.
And your patch changes current behaviour of mcedit.  ASCII zero is equal 
to newline now.  I cannot say I like this, but you should be consistent.
Now 0 is checked in the right part of the line, but this check is 
ommited at the left.

--
Regards,
Andrew V. Samoilov.

> 
> 
> ------------------------------------------------------------------------
> 
> --- edit.c	Wed Nov  6 16:33:21 2002
> +++ edit.c.new	Wed Nov  6 16:34:44 2002
> @@ -1770,14 +1770,20 @@
>  void edit_delete_line (WEdit * edit)
>  {
>      int c;
> +
> +    /* Delete right part of the line (including '\n' char) */
>      do {
> -	c = edit_delete (edit);
> -    } while (c != '\n' && c);
> -    do {
> -	c = edit_backspace (edit);
> +        c = edit_delete (edit);
>      } while (c != '\n' && c);
> -    if (c)
> -	edit_insert (edit, '\n');
> +    
> +    /*
> +     * Delete left part of the line.
> +     * Note, that edit_get_byte() returns '\n' when byte position is < 0.
> +     */
> +    while (edit_get_byte (edit, edit->curs1 - 1) != '\n')
> +    {
> +        (void) edit_backspace (edit);
> +    };
>  }
>  
>  static void insert_spaces_tab (WEdit * edit, int half)






More information about the mc-devel mailing list