Skip to content

Commit

Permalink
Fix gradual sorting to the right (oops)
Browse files Browse the repository at this point in the history
  • Loading branch information
b4n committed Jul 30, 2016
1 parent b1528f0 commit d2bf717
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/notebook.c
Expand Up @@ -876,7 +876,7 @@ void on_sort_tabs_pathname_activate(GtkMenuItem *menuitem, gpointer user_data)

static void gradually_sort_tab(GeanyDocument *doc, NotebookTabSortMethod method)
{
gint pos, n_pages;
gint i, pos, n_pages;
GCompareFunc func;

if (method == NOTEBOOK_TAB_SORT_FILENAME)
Expand All @@ -886,12 +886,17 @@ static void gradually_sort_tab(GeanyDocument *doc, NotebookTabSortMethod method)

n_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook));

for (pos = 0; pos < n_pages; ++pos)
for (pos = 0, i = 0; i < n_pages; i++)
{
GeanyDocument *doc_b = document_get_from_page(pos);
GeanyDocument *doc_b = document_get_from_page(i);

if (doc_b != doc && func (&doc, &doc_b) < 0)
break;
if (doc_b != doc)
{
if (func (&doc, &doc_b) < 0)
break;

pos++;
}
}

move_tab(doc, pos);
Expand Down

0 comments on commit d2bf717

Please sign in to comment.