Kaydet (Commit) 25b85ba0 authored tarafından Nick Treleaven's avatar Nick Treleaven

Make Fold All/Unfold All attempt to scroll the current line in view.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1989 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 28504ed8
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
Disable file and directory diff menu items if the current document Disable file and directory diff menu items if the current document
has no filename. has no filename.
Disable project menu item when no project is open. Disable project menu item when no project is open.
* src/document.c:
Make Fold All/Unfold All attempt to scroll the current line in view.
2007-10-28 Enrico Tröger <enrico.troeger@uvena.de> 2007-10-28 Enrico Tröger <enrico.troeger@uvena.de>
......
...@@ -1908,40 +1908,37 @@ gchar *document_get_eol_mode(gint idx) ...@@ -1908,40 +1908,37 @@ gchar *document_get_eol_mode(gint idx)
} }
void document_unfold_all(gint idx) static void fold_all(gint idx, gboolean want_fold)
{ {
gint lines, pos, i; gint lines, first, i;
if (idx == -1 || ! doc_list[idx].is_valid) return; if (! DOC_IDX_VALID(idx)) return;
lines = sci_get_line_count(doc_list[idx].sci); lines = sci_get_line_count(doc_list[idx].sci);
pos = sci_get_current_position(doc_list[idx].sci); first = sci_get_first_visible_line(doc_list[idx].sci);
for (i = 0; i < lines; i++) for (i = 0; i < lines; i++)
{ {
sci_ensure_line_is_visible(doc_list[idx].sci, i); gint level = sci_get_fold_level(doc_list[idx].sci, i);
if (level & SC_FOLDLEVELHEADERFLAG)
{
if (sci_get_fold_expanded(doc_list[idx].sci, i) == want_fold)
sci_toggle_fold(doc_list[idx].sci, i);
}
} }
editor_scroll_to_line(doc_list[idx].sci, first, 0.0F);
} }
void document_fold_all(gint idx) void document_unfold_all(gint idx)
{ {
gint lines, pos, i; fold_all(idx, FALSE);
}
if (idx == -1 || ! doc_list[idx].is_valid) return;
lines = sci_get_line_count(doc_list[idx].sci);
pos = sci_get_current_position(doc_list[idx].sci);
for (i = 0; i < lines; i++) void document_fold_all(gint idx)
{ {
gint level = sci_get_fold_level(doc_list[idx].sci, i); fold_all(idx, TRUE);
if (level & SC_FOLDLEVELHEADERFLAG)
{
if (sci_get_fold_expanded(doc_list[idx].sci, i))
sci_toggle_fold(doc_list[idx].sci, i);
}
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment