Re: [PATCH] Editor file locking
- From: Adam Byrtek / alpha <alpha student uci agh edu pl>
- To: Pavel Roskin <proski gnu org>
- Cc: MC-devel <mc-devel gnome org>
- Subject: Re: [PATCH] Editor file locking
- Date: Fri, 4 Apr 2003 15:24:18 +0200
On Wed, Apr 02, 2003 at 02:48:07PM -0500, Pavel Roskin wrote:
> One bug that needs to be fixed - if I use Enter to modify the file and I
> get a "file locked" message, the old current line is not repainted. Try
> it to see what I mean.
Looks like it is because the screen gets refreshed after query_dialog,
and edit->force value set in edit_insert is lost...
Patch attached.
--
_.|._ |_ _. : Adam Byrtek /alpha alpha debian org
(_|||_)| |(_| : http://krakow.linux.org.pl/ pgp 0xB25952C0
|
Index: edit.c
===================================================================
RCS file: /cvs/gnome/mc/edit/edit.c,v
retrieving revision 1.75
diff -u -r1.75 edit.c
--- edit.c 2 Apr 2003 22:25:00 -0000 1.75
+++ edit.c 4 Apr 2003 13:23:21 -0000
@@ -838,6 +838,10 @@
if (c == '\n')
edit->start_line++;
}
+
+ /* tell that we've modified the file */
+ edit_modification (edit);
+
/* now we must update some info on the file and check if a redraw is required */
if (c == '\n') {
if (edit->book_mark)
@@ -846,8 +850,6 @@
edit->total_lines++;
edit->force |= REDRAW_LINE_ABOVE | REDRAW_AFTER_CURSOR;
}
- /* tell that we've modified the file */
- edit_modification (edit);
/* save the reverse command onto the undo stack */
edit_push_action (edit, BACKSPACE);
@@ -885,13 +887,13 @@
if (c == '\n')
edit->start_line++;
}
+ edit_modification (edit);
if (c == '\n') {
if (edit->book_mark)
book_mark_inc (edit, edit->curs_line);
edit->total_lines++;
edit->force |= REDRAW_AFTER_CURSOR;
}
- edit_modification (edit);
edit_push_action (edit, DELCHAR);
edit->mark1 += (edit->mark1 >= edit->curs1);
@@ -926,6 +928,7 @@
edit->last_byte--;
edit->curs2--;
+ edit_modification (edit);
if (p == '\n') {
if (edit->book_mark)
book_mark_dec (edit, edit->curs_line);
@@ -938,7 +941,6 @@
if (p == '\n')
edit->start_line--;
}
- edit_modification (edit);
return p;
}
@@ -963,6 +965,7 @@
edit->last_byte--;
edit->curs1--;
+ edit_modification (edit);
if (p == '\n') {
if (edit->book_mark)
book_mark_dec (edit, edit->curs_line);
@@ -977,7 +980,6 @@
if (p == '\n')
edit->start_line--;
}
- edit_modification (edit);
return p;
}
Index: editlock.c
===================================================================
RCS file: /cvs/gnome/mc/edit/editlock.c,v
retrieving revision 1.2
diff -u -r1.2 editlock.c
--- editlock.c 2 Apr 2003 22:25:00 -0000 1.2
+++ editlock.c 4 Apr 2003 13:23:22 -0000
@@ -97,7 +97,8 @@
/* Tries to raise file lock
- Returns 1 on success, 0 on failure, -1 if abort */
+ Returns 1 on success, 0 on failure, -1 if abort
+ Warning: Might do screen refresh and lose edit->force */
int
edit_lock_file (char *fname)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]