From 2eeb950439ad749d6c2d255a5a0a78a59aa2bf3b Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 2 Dec 2012 13:36:00 +0400 Subject: [PATCH] Keep some edit window parameters during file reloading. Signed-off-by: Andrew Borodin --- src/editor/edit.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index 49d9f7755..37bab98e2 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -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; 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); + + /* 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 { #ifdef ENABLE_NLS @@ -2366,15 +2382,16 @@ edit_reload_line (WEdit * edit, const vfs_path_t * filename_vpath, long line) Widget *w = WIDGET (edit); WEdit *e; - int y = w->y; - int x = w->x; - int lines = w->lines; - int columns = w->cols; - e = g_malloc0 (sizeof (WEdit)); *WIDGET (e) = *w; - - if (edit_init (e, y, x, lines, columns, filename_vpath, line) == NULL) + /* 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, w->y, w->x, w->lines, w->cols, filename_vpath, line) == NULL) { g_free (e); return FALSE; -- 2.11.4.GIT