aboutsummaryrefslogtreecommitdiff
path: root/src/sc_editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r--src/sc_editor.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index a82ffc9..76be18d 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -89,6 +89,10 @@ static void vertical_adjust(GtkAdjustment *adj, SCEditor *e)
static void set_vertical_params(SCEditor *e)
{
if ( e->vadj == NULL ) return;
+ if ( e->scroll_pos < 0.0 ) e->scroll_pos = 0.0;
+ if ( e->scroll_pos > e->h - e->visible_height ) {
+ e->scroll_pos = e->h - e->visible_height;
+ }
gtk_adjustment_configure(e->vadj, e->scroll_pos, 0, e->h, 100,
e->visible_height, e->visible_height);
}
@@ -1619,7 +1623,7 @@ void sc_editor_set_cursor_para(SCEditor *e, signed int pos)
}
if ( pos < 0 ) {
- e->cursor_para = e->cursor_frame->n_paras;
+ e->cursor_para = e->cursor_frame->n_paras - 1;
} else if ( pos >= e->cursor_frame->n_paras ) {
e->cursor_para = e->cursor_frame->n_paras - 1;
} else {