Skip to content

Commit 767da28

Browse files
committed
svnbrowse: When going up a directory, select the recently visited node in the
list. * subversion/svnbrowse/model.c (svn_browse__model_go_up): Loop through all items in the list to find the node with the same matching name as the name we obtained from svn_relpath_split(). In case if no items were found with this name (which is possible as it could be deleted by now), just select the first element. * subversion/svnbrowse/svnbrowse.c (view_on_event): Center the view after executing go_up action; The exact same code as in 'z' handling. git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1932956 13f79535-47bb-0310-9956-ffa450edef68
1 parent c925fbb commit 767da28

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

subversion/svnbrowse/model.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,27 @@ svn_browse__model_go_enter(svn_browse__model_t *model, apr_pool_t *scratch_pool)
165165
svn_error_t *
166166
svn_browse__model_go_up(svn_browse__model_t *model, apr_pool_t *scratch_pool)
167167
{
168-
const char *new_url = svn_relpath_dirname(model->current->relpath,
169-
scratch_pool);
170-
return svn_error_trace(svn_browse__model_enter_path(model, new_url,
171-
scratch_pool));
168+
const char *dirpath, *name;
169+
int i;
170+
171+
svn_relpath_split(&dirpath, &name, model->current->relpath, scratch_pool);
172+
173+
SVN_ERR(svn_browse__model_enter_path(model, dirpath, scratch_pool));
174+
175+
/* find previously visited node in the list to select it as we go a dir up */
176+
for (i = 0; i < model->current->list->nelts; i++)
177+
{
178+
svn_browse__item_t *item = APR_ARRAY_IDX(model->current->list, i,
179+
svn_browse__item_t *);
180+
181+
if (strcmp(item->name, name) == 0)
182+
{
183+
model->current->selection = i;
184+
break;
185+
}
186+
}
187+
188+
return SVN_NO_ERROR;
172189
}
173190

174191
svn_error_t *

subversion/svnbrowse/svnbrowse.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ view_on_event(svn_browse__view_t *view, int ch, apr_pool_t *scratch_pool)
158158
case '-':
159159
case 'u':
160160
SVN_ERR(svn_browse__model_go_up(view->model, scratch_pool));
161+
view->model->current->scroller_offset =
162+
view->model->current->selection - scrollsize / 2;
161163
break;
162164
case CTRL('e'):
163165
view->model->current->scroller_offset += 1;

0 commit comments

Comments
 (0)