Don't scroll the editor view if it is unnecessary when using Go to

Marker or Go to Matching Brace commands.
Make sci_set_current_line() not scroll the view, unlike
sci_goto_line().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2275 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-02-22 17:29:45 +00:00
parent 3714cf498f
commit d4c06b714d
3 changed files with 16 additions and 8 deletions

View File

@ -7,6 +7,11 @@
src/editor.h:
Don't scroll the editor view if it is unnecessary when using Find
Next/Previous, Find Selected and when searching from the search bar.
* src/keybindings.c, src/sciwrappers.c:
Don't scroll the editor view if it is unnecessary when using Go to
Marker or Go to Matching Brace commands.
Make sci_set_current_line() not scroll the view, unlike
sci_goto_line().
2008-02-22 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -1135,8 +1135,8 @@ static void goto_matching_brace(gint idx)
new_pos = sci_find_bracematch(doc_list[idx].sci, pos);
if (new_pos != -1)
{
sci_goto_pos(doc_list[idx].sci, new_pos, TRUE); // set the cursor at the brace
doc_list[idx].scroll_percent = 0.5F;
sci_set_current_position(doc_list[idx].sci, new_pos, FALSE); // set the cursor at the brace
editor_display_current_line(idx, 0.5F);
}
}
@ -1187,8 +1187,8 @@ static void cb_func_edit_global(guint key_id)
if (mline != -1)
{
sci_goto_line(doc_list[idx].sci, mline, TRUE);
doc_list[idx].scroll_percent = 0.5F;
sci_set_current_line(doc_list[idx].sci, mline);
editor_display_current_line(idx, 0.5F);
}
break;
}
@ -1198,8 +1198,8 @@ static void cb_func_edit_global(guint key_id)
if (mline != -1)
{
sci_goto_line(doc_list[idx].sci, mline, TRUE);
doc_list[idx].scroll_percent = 0.5F;
sci_set_current_line(doc_list[idx].sci, mline);
editor_display_current_line(idx, 0.5F);
}
break;
}

View File

@ -401,9 +401,12 @@ void sci_set_current_position(ScintillaObject* sci, gint position, gboolean scro
}
void sci_set_current_line(ScintillaObject* sci, gint line )
/* Set the cursor line without scrolling the view.
* Use sci_goto_line() to also scroll. */
void sci_set_current_line(ScintillaObject* sci, gint line)
{
SSM(sci, SCI_GOTOLINE, line, 0);
gint pos = sci_get_position_from_line(sci, line);
sci_set_current_position(sci, pos, FALSE);
}