1
1

* view.c (get_line_at): previous newline is right condition

for regexp '^' pattern also, fixed

(search) [HAVE_GNOME]: gnome_message_box_new don't expand printf
pattern, so g_strdup_printf used

* find.c (find_parameters): don't use stat structure if mc_stat failed
Этот коммит содержится в:
Andrew V. Samoilov 2001-04-24 14:39:38 +00:00
родитель 94fc1dd4e3
Коммит 42dd6b0b90
3 изменённых файлов: 44 добавлений и 37 удалений

Просмотреть файл

@ -1,3 +1,13 @@
2001-04-24 Andrew V. Samoilov <sav@bcs.zp.ua>
* view.c (get_line_at): previous newline is right condition
for regexp '^' pattern also, fixed
(search) [HAVE_GNOME]: gnome_message_box_new don't expand printf
pattern, so g_strdup_printf used
* find.c (find_parameters): don't use stat structure if mc_stat failed
2001-04-17 Pavel Roskin <proski@gnu.org>
* subshell.c (init_raw_mode): New function, separated from ...

Просмотреть файл

@ -433,15 +433,11 @@ search_content (Dlg_head *h, char *directory, char *filename)
fname = concat_dir_and_file (directory, filename);
if (mc_stat (fname, &s) != 0 && !S_ISREG (s.st_mode)){
if (mc_stat (fname, &s) != 0 || !S_ISREG (s.st_mode)){
g_free (fname);
return;
}
if (!S_ISREG (s.st_mode)){
g_free (fname);
return;
}
file_fd = mc_open (fname, O_RDONLY);
g_free (fname);
@ -471,15 +467,14 @@ search_content (Dlg_head *h, char *directory, char *filename)
enable_interrupt_key ();
got_interrupt ();
while (1){
i = read (pipe, &c, 1);
if (i != 1)
break;
while ((i = read (pipe, &c, 1)) == 0){
if (c == '\n'){
p = buffer;
ignoring = 0;
}
if (ignoring)
continue;
@ -756,7 +751,7 @@ find_do_edit (void)
static void
setup_gui (void)
{
GtkWidget *sw, *b1, *b2, *b3;
GtkWidget *sw, *b1, *b2;
GtkWidget *box, *box2;
g_find_dlg = gnome_dialog_new (

Просмотреть файл

@ -1403,49 +1403,48 @@ static char *
get_line_at (WView *view, unsigned long *p, unsigned long *skipped)
{
char *buffer = 0;
int buffer_size, usable_size;
int ch = 0;
int direction;
int buffer_size = 0;
int usable_size = 0;
int ch;
int direction = view->direction;
unsigned long pos = *p;
long i = 0;
int prev;
int prev = 0;
direction = view->direction;
buffer_size = usable_size = 0;
prev = (pos) ? ((prev = get_byte (view, pos - 1) == -1) ? 0 : prev) : 0;
*skipped = 0;
while ((ch = get_byte (view, pos)) != -1){
/* skip over all the possible zeros in the file */
while ((ch = get_byte (view, pos)) == 0) {
pos += direction; i++;
}
*skipped = i;
if (pos) {
prev = get_byte (view, pos - 1);
if ((prev == -1) || (prev == '\n'))
prev = 0;
}
for (i = 0; ch > 0; ch = get_byte (view, pos)){
/* skip over all the possible zeros in the file */
if (ch == 0 && i == 0){
do {
pos += direction; i++;
} while ((ch = get_byte (view, pos)) == 0);
*skipped = i;
i = 0;
if (ch == -1)
break;
}
if (i == usable_size){
buffer = grow_string_buffer (buffer, &buffer_size);
usable_size = buffer_size - 2;
}
pos += direction; i++;
buffer [i] = ch;
if (ch == '\n' || !ch){
if (ch == '\n'){
break;
}
buffer [i] = ch;
}
if (buffer){
buffer [0] = prev;
buffer [i] = 0;
/* If we are searching backwards, reverse the string */
if (view->direction < 0)
reverse_string (buffer);
if (direction < 0) {
reverse_string (buffer + 1);
}
}
*p = pos;
@ -1492,6 +1491,7 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int))
Dlg_head *d = 0;
int search_status;
#ifdef HAVE_GNOME
char *msg;
int abort;
GtkWidget *gd;
#endif
@ -1507,10 +1507,12 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int))
#ifdef HAVE_GNOME
abort = 0;
gd = gnome_message_box_new (_("Searching for `%s'"),
msg = g_strdup_printf (_("Searching for `%s'"), text);
gd = gnome_message_box_new (msg,
GNOME_MESSAGE_BOX_INFO,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
g_free (msg);
gnome_dialog_button_connect (GNOME_DIALOG (gd), 0, GTK_SIGNAL_FUNC (cancel_pressed), &abort);
gtk_widget_show (gd);
#else