I improved the movement keys of the internal viewer a little bit.

Now in wrap mode the End key and cursor up key behave much better
(e.g. when viewing binary files with lots of wrapped lines).
It's not perfekt but it's better than it used to be.



Tue Apr 28 06:52:24 1998  Norbert Warmuth  <k3190@fh-sw.de>

* gnome/gcmd.c (gnome_open_terminal): Changed my_system(1,...) to
my_system(EXECUTE_AS_SHELL,...)


Tue Apr 28 06:06:03 1998  Norbert Warmuth  <k3190@fh-sw.de>

* vfs/extfs.c (extfs_open, extfs_close): Changed my_system(1,...)
to my_system(EXECUTE_AS_SHELL,...), this fixes the broken copyin and
copyout in 4.1.32.


Tue Apr 28 06:11:08 1998  Norbert Warmuth  <k3190@fh-sw.de>

* view.c (toggle_wrap_mode, toggle_hex_mode): Force recalculation
of bottom_first (we mustn't use an already calculated and cached
value because it is invalid for the new mode and the End key would
not move to the end of the file).

* configure.in: Renamed the option `--with-our-slang' to
`--with-included-slang' (this one looks better because we also
have an `--with-included-gettext').
Make the option `--with-ext2undel' recognice a given path.

* cmd.c (view_file_at_line): In plain view (F13) set the default
magic flag to zero in order to view the file content unprocessed
(esp. don't uncompress files if they are compressed). The
view_simple_cmd got broken when the default magic flag in view.c
was changed from 0 to 1.

* view.c (do_view_init, goto_line): Set wrap mode temporary off
to make goto line number work, i.e. `line number' now always means
line number in file and not line number on screen (in wrap mode
one long line wrapped once is displayed in two lines on the screen).
That's important when the viewer is invoked from the find file
dialog to display even in wrap mode approxiamtly the part of the
file where we found the content we searched for.

(move_forward2): In wrap mode lines were sometimes counted wrong
causing cursor up to move more than one line.

(move_backward2): Fixed the movement in wrap mode.

(change_viewer): Always re-init viewer when we have a filename,
i. e. if the viewer is invoked with simple_view_cmd then we can switch
with the F8 key between unprocessed file content und uncompressed
file content.
(view_init): re-init view also when magic flag was altered
This commit is contained in:
Norbert Warmuth 1998-04-28 14:19:48 +00:00
parent 8c34e0837f
commit 097fe43280
8 changed files with 106 additions and 36 deletions

View File

@ -1014,8 +1014,8 @@ AC_ARG_WITH(termcap,
]
)
AC_ARG_WITH(our-slang,
[--with-our-slang SLANG: Don't use system-installed SLang],[
AC_ARG_WITH(included-slang,
[--with-included-slang SLANG: use the SLang library included here],[
slang_use_system_installed_lib=false
slang_check_lib=true
]
@ -1179,8 +1179,13 @@ AC_DEFUN(AC_EXT2_UNDEL, [
AC_ARG_WITH(ext2undel,
[--with-ext2undel Compile with ext2 undelete code],[
if test x$withval = xyes;
if test x$withval != xno;
then
if test x$withval != xyes
then
LIBS="$LIBS -L$withval/lib"
CPPFLAGS="$CPPFLAGS -I$withval/include"
fi
AC_EXT2_UNDEL
fi],
dnl Default: detect

View File

@ -1,3 +1,8 @@
Tue Apr 28 06:52:24 1998 Norbert Warmuth <k3190@fh-sw.de>
* gcmd.c (gnome_open_terminal): Changed my_system(1,...) to
my_system(EXECUTE_AS_SHELL,...)
1998-04-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
* glayout.c (layout_panel_gone): Removed debugging information.

View File

@ -58,7 +58,7 @@ gnome_open_terminal (void)
p = gnome_is_program_in_path ("xterm");
if (p)
my_system (1, shell, p);
my_system (EXECUTE_AS_SHELL, shell, p);
else
message (1, MSG_ERROR, " Could not start a terminal ");
}

View File

@ -1,3 +1,40 @@
Tue Apr 28 06:11:08 1998 Norbert Warmuth <k3190@fh-sw.de>
* view.c (toggle_wrap_mode, toggle_hex_mode): Force recalculation
of bottom_first (we mustn't use an already calculated and cached
value because it is invalid for the new mode and the End key would
not move to the end of the file).
* configure.in: Renamed the option `--with-our-slang' to
`--with-included-slang' (this one looks better because we also
have an `--with-included-gettext').
Make the option `--with-ext2undel' recognice a given path.
* cmd.c (view_file_at_line): In plain view (F13) set the default
magic flag to zero in order to view the file content unprocessed
(esp. don't uncompress files if they are compressed). The
view_simple_cmd got broken when the default magic flag in view.c
was changed from 0 to 1.
* view.c (do_view_init, goto_line): Set wrap mode temporary off
to make goto line number work, i.e. `line number' now always means
line number in file and not line number on screen (in wrap mode
one long line wrapped once is displayed in two lines on the screen).
That's important when the viewer is invoked from the find file
dialog to display even in wrap mode approxiamtly the part of the
file where we found the content we searched for.
(move_forward2): In wrap mode lines were sometimes counted wrong
causing cursor up to move more than one line.
(move_backward2): Fixed the movement in wrap mode.
(change_viewer): Always re-init viewer when we have a filename,
i. e. if the viewer is invoked with simple_view_cmd then we can switch
with the F8 key between unprocessed file content und uncompressed
file content.
(view_init): re-init view also when magic flag was altered
1998-04-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
* screen.c (is_a_panel): Added a routine to determine if a widget

View File

@ -146,20 +146,27 @@ int view_file_at_line (char *filename, int plain_view, int internal, int start_l
if (plain_view) {
int changed_hex_mode = 0;
int changed_nroff_flag = 0;
int changed_magic_flag = 0;
altered_hex_mode = 0;
altered_nroff_flag = 0;
altered_magic_flag = 0;
if (default_hex_mode)
changed_hex_mode = 1;
if (default_nroff_flag)
changed_nroff_flag = 1;
if (default_magic_flag)
changed_magic_flag = 1;
default_hex_mode = 0;
default_nroff_flag = 0;
default_magic_flag = 0;
view (0, filename, &move_dir, start_line);
if (changed_hex_mode && !altered_hex_mode)
default_hex_mode = 1;
if (changed_nroff_flag && !altered_nroff_flag)
default_nroff_flag = 1;
if (changed_magic_flag && !altered_magic_flag)
default_magic_flag = 1;
repaint_screen ();
return move_dir;
}

View File

@ -629,8 +629,12 @@ do_view_init (WView *view, char *_command, char *_file, int start_line)
view->last_byte = view->first + view->s.st_size;
if (start_line > 1 && !error){
int saved_wrap_mode = view->wrap_mode;
view->wrap_mode = 0;
get_byte (view, 0);
view_move_forward (view, start_line - 1);
view->wrap_mode = saved_wrap_mode;
}
view->edit_cursor = view->first;
view->file_dirty = 0;
@ -658,7 +662,7 @@ view_init (WView *view, char *_command, char *_file, int start_line)
view->bytes_per_line = 2 * (cols - 7) / 9;
view->bytes_per_line &= 0xfffc;
view->dirty = max_dirt_limit + 1; /* To force refresh */
if (!view->view_active || strcmp (_file, view->filename))
if (!view->view_active || strcmp (_file, view->filename) || altered_magic_flag)
return do_view_init (view, _command, _file, start_line);
else
return 0;
@ -1084,9 +1088,6 @@ move_forward2 (WView *view, long current, int lines, long upto)
int line;
int col = 0;
if (!upto && !view->hex_mode && view->last == view->last_byte)
return current;
if (view->hex_mode){
p = current + lines * view->bytes_per_line;
p = (p >= view->last_byte) ? current : p;
@ -1110,6 +1111,8 @@ move_forward2 (WView *view, long current, int lines, long upto)
q = upto;
} else
q = view->last_byte;
if (get_byte (view, q) != '\n')
q++;
for (line = col = 0, p = current; p < q; p++){
int c;
@ -1166,7 +1169,7 @@ move_forward2 (WView *view, long current, int lines, long upto)
static long
move_backward2 (WView *view, long current, int lines)
{
long p, q;
long p, q, pm;
int line;
if (!view->hex_mode && current == view->first)
@ -1193,24 +1196,26 @@ move_backward2 (WView *view, long current, int lines)
line = 1;
else
line = 0;
for (q = p = current - 1; p > view->first; p--)
if (get_byte (view, p) == '\n')
for (q = p = current - 1; p >= view->first; p--)
if (get_byte (view, p) == '\n' || p == view->first) {
pm = p > view->first ? p + 1 : view->first;
if (!view->wrap_mode){
if (line == lines)
return p + 1;
return pm;
line++;
} else {
line += move_forward2 (view, p + 1, 0, q);
line += move_forward2 (view, pm, 0, q);
if (line >= lines){
if (line == lines)
return p + 1;
return pm;
else
return move_forward2 (view, p + 1, line - lines, 0);
return move_forward2 (view, pm, line - lines, 0);
}
q = p + 1;
}
}
}
return p;
return p > view->first ? p : view->first;
}
void
@ -1776,7 +1781,7 @@ void toggle_wrap_mode (WView *view)
if (view->growing_buffer != 0) {
return;
}
get_bottom_first (view, 1, 0);
get_bottom_first (view, 1, 1);
if (view->hexedit_mode) {
view->view_side = 1 - view->view_side;
} else {
@ -1788,7 +1793,7 @@ void toggle_wrap_mode (WView *view)
return;
}
view->wrap_mode = 1 - view->wrap_mode;
get_bottom_first (view, 1, 0);
get_bottom_first (view, 1, 1);
if (view->wrap_mode)
view->start_col = 0;
else {
@ -1822,7 +1827,7 @@ toggle_hex_mode (WView *view)
view->widget.options &= ~W_WANT_CURSOR;
}
altered_hex_mode = 1;
get_bottom_first (view, 1, 0);
get_bottom_first (view, 1, 1);
view_labels (view);
view->dirty++;
view_update (view);
@ -1841,7 +1846,9 @@ goto_line (WView *view)
{
char *line, prompt [100];
int i, oldline = 1;
int saved_wrap_mode = view->wrap_mode;
view->wrap_mode = 0;
for (i = view->first; i < view->start_display; i++)
if (get_byte (view, i) == '\n')
oldline ++;
@ -1856,6 +1863,7 @@ goto_line (WView *view)
free (line);
}
view->dirty++;
view->wrap_mode = saved_wrap_mode;
view_update (view);
}
@ -1928,25 +1936,27 @@ normal_search_cmd (WView *view)
void
change_viewer (WView *view)
{
altered_magic_flag = 1;
if (!view->command){
view->viewer_magic_flag = !view->viewer_magic_flag;
view_labels (view);
} else {
char *s = strdup (view->filename);
char *t = strdup (view->command);
char *s;
char *t;
if (*view->filename) {
altered_magic_flag = 1;
view->viewer_magic_flag = !view->viewer_magic_flag;
s = strdup (view->filename);
if (view->command)
t = strdup (view->command);
else
t = 0;
view_done (view);
/* Is it possible to not use the growing buffers? */
if (!(*t && !*s))
view->viewer_magic_flag = !view->viewer_magic_flag;
view_init (view, t, s, 0);
free (s);
free (t);
view_labels (view);
view->dirty++;
view_update (view);
if (t)
free (t);
view_labels (view);
view->dirty++;
view_update (view);
}
}

View File

@ -1,3 +1,9 @@
Tue Apr 28 06:06:03 1998 Norbert Warmuth <k3190@fh-sw.de>
* extfs.c (extfs_open, extfs_close): Changed my_system(1,...) to
my_system(EXECUTE_AS_SHELL,...), this fixes the broken copyin and
copyout of 4.1.32.
1998-04-23 Miguel de Icaza <miguel@nuclecu.unam.mx>
* ftpfs.c (retrieve_file_start2): Open file exclusively.

View File

@ -760,7 +760,7 @@ static void *extfs_open (char *file, int flags, int mode)
" ", q, " ", entry->inode->local_filename, 0);
free (q);
free (archive_name);
if (my_system (1, shell, cmd) && !do_create){
if (my_system (EXECUTE_AS_SHELL, shell, cmd) && !do_create){
free (entry->inode->local_filename);
entry->inode->local_filename = NULL;
free (cmd);
@ -823,7 +823,7 @@ static int extfs_close (void *data)
file->entry->inode->local_filename, 0);
free (archive_name);
free (file_name);
if (my_system (1, shell, cmd))
if (my_system (EXECUTE_AS_SHELL, shell, cmd))
errno_code = EIO;
free (cmd);
{