Keep some edit window parameters during file reloading.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-12-02 13:36:00 +04:00
parent d50d1d748d
commit 2eeb950439

View File

@ -2205,7 +2205,23 @@ edit_init (WEdit * edit, int y, int x, int lines, int cols, const vfs_path_t * f
option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0; option_line_state_width = option_line_state ? LINE_STATE_WIDTH : 0;
if (edit != NULL) if (edit != NULL)
{
/* save some widget parameters */
gboolean fullscreen = edit->fullscreen;
int y_prev = edit->y_prev;
int x_prev = edit->x_prev;
int lines_prev = edit->lines_prev;
int cols_prev = edit->cols_prev;
edit_purge_widget (edit); edit_purge_widget (edit);
/* restore saved parameters */
edit->fullscreen = fullscreen;
edit->y_prev = y_prev;
edit->x_prev = x_prev;
edit->lines_prev = lines_prev;
edit->cols_prev = cols_prev;
}
else else
{ {
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
@ -2366,15 +2382,16 @@ edit_reload_line (WEdit * edit, const vfs_path_t * filename_vpath, long line)
Widget *w = WIDGET (edit); Widget *w = WIDGET (edit);
WEdit *e; WEdit *e;
int y = w->y;
int x = w->x;
int lines = w->lines;
int columns = w->cols;
e = g_malloc0 (sizeof (WEdit)); e = g_malloc0 (sizeof (WEdit));
*WIDGET (e) = *w; *WIDGET (e) = *w;
/* save some widget parameters */
e->fullscreen = edit->fullscreen;
e->y_prev = edit->y_prev;
e->x_prev = edit->x_prev;
e->lines_prev = edit->lines_prev;
e->cols_prev = edit->cols_prev;
if (edit_init (e, y, x, lines, columns, filename_vpath, line) == NULL) if (edit_init (e, w->y, w->x, w->lines, w->cols, filename_vpath, line) == NULL)
{ {
g_free (e); g_free (e);
return FALSE; return FALSE;