Merge pull request #1154 from b4n/lines-around-scroll
Add support for keeping the cursor a number of lines from the edges
This commit is contained in:
commit
d3b0bbec26
@ -29,6 +29,11 @@
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">158.44</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment13">
|
||||
<property name="upper">100</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment2">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">99</property>
|
||||
@ -3861,6 +3866,49 @@
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_markup">Number of lines to maintain between the cursor and the top and bottom edges of the view. This allows some lines of context around the cursor to always be visible. If <i>Stop scrolling at last line</i> is <b>disabled</b>, the cursor will never reach the bottom edge when this value is greater than 0.</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label25">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Lines visible _around the cursor:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">spin_scroll_lines_around_cursor</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="spin_scroll_lines_around_cursor">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
<property name="adjustment">adjustment13</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -2254,6 +2254,12 @@ Stop scrolling at last line
|
||||
When enabled Geany stops scrolling when at the last line of the document.
|
||||
Otherwise you can scroll one more page even if there are no real lines.
|
||||
|
||||
Lines visible around the cursor
|
||||
The number of lines to maintain between the cursor and the top and bottom
|
||||
edges of the view. This allows some lines of context around the cursor to
|
||||
always be visible. If *Stop scrolling at last line* is disabled, the cursor
|
||||
will never reach the bottom edge when this value is greater than 0.
|
||||
|
||||
|
||||
Long line marker
|
||||
````````````````
|
||||
|
@ -4908,7 +4908,7 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor)
|
||||
sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
|
||||
sci_set_lines_wrapped(sci, editor->line_wrapping);
|
||||
sci_set_caret_policy_x(sci, CARET_JUMPS | CARET_EVEN, 0);
|
||||
/*sci_set_caret_policy_y(sci, CARET_JUMPS | CARET_EVEN, 0);*/
|
||||
/* Y policy is set in editor_apply_update_prefs() */
|
||||
SSM(sci, SCI_AUTOCSETSEPARATOR, '\n', 0);
|
||||
SSM(sci, SCI_SETSCROLLWIDTHTRACKING, 1, 0);
|
||||
|
||||
@ -5134,6 +5134,7 @@ void editor_set_indentation_guides(GeanyEditor *editor)
|
||||
void editor_apply_update_prefs(GeanyEditor *editor)
|
||||
{
|
||||
ScintillaObject *sci;
|
||||
int caret_y_policy;
|
||||
|
||||
g_return_if_fail(editor != NULL);
|
||||
|
||||
@ -5169,6 +5170,12 @@ void editor_apply_update_prefs(GeanyEditor *editor)
|
||||
/* virtual space */
|
||||
SSM(sci, SCI_SETVIRTUALSPACEOPTIONS, editor_prefs.show_virtual_space, 0);
|
||||
|
||||
/* caret Y policy */
|
||||
caret_y_policy = CARET_EVEN;
|
||||
if (editor_prefs.scroll_lines_around_cursor > 0)
|
||||
caret_y_policy |= CARET_SLOP | CARET_STRICT;
|
||||
sci_set_caret_policy_y(sci, caret_y_policy, editor_prefs.scroll_lines_around_cursor);
|
||||
|
||||
/* (dis)allow scrolling past end of document */
|
||||
sci_set_scroll_stop_at_last_line(sci, editor_prefs.scroll_stop_at_last_line);
|
||||
|
||||
|
@ -136,6 +136,7 @@ typedef struct GeanyEditorPrefs
|
||||
gint show_virtual_space;
|
||||
gboolean long_line_enabled;
|
||||
gint autocompletion_update_freq;
|
||||
gint scroll_lines_around_cursor;
|
||||
}
|
||||
GeanyEditorPrefs;
|
||||
|
||||
|
@ -215,6 +215,8 @@ static void init_pref_groups(void)
|
||||
"autocompletion_update_freq", GEANY_MAX_SYMBOLS_UPDATE_FREQ, "spin_symbol_update_freq");
|
||||
stash_group_add_string(group, &editor_prefs.color_scheme,
|
||||
"color_scheme", NULL);
|
||||
stash_group_add_spin_button_integer(group, &editor_prefs.scroll_lines_around_cursor,
|
||||
"scroll_lines_around_cursor", 0, "spin_scroll_lines_around_cursor");
|
||||
|
||||
/* files */
|
||||
stash_group_add_spin_button_integer(group, (gint*)&file_prefs.mru_length,
|
||||
|
Loading…
x
Reference in New Issue
Block a user