Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
0c7da84e
Commit
0c7da84e
authored
Nov 11, 1996
by
Richard M. Stallman
Browse files
(window_scroll): Handle scroll_margin
by putting point at a place that won't force recentering.
parent
7e90bcf5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
src/window.c
src/window.c
+28
-3
No files found.
src/window.c
View file @
0c7da84e
...
...
@@ -2684,18 +2684,43 @@ window_scroll (window, n, noerror)
if
(
pos
<
ZV
)
{
extern
int
scroll_margin
;
int
this_scroll_margin
=
scroll_margin
;
/* Don't use a scroll margin that is negative or too large. */
if
(
this_scroll_margin
<
0
)
this_scroll_margin
=
0
;
if
(
XINT
(
w
->
height
)
<
4
*
scroll_margin
)
this_scroll_margin
=
XINT
(
w
->
height
)
/
4
;
set_marker_restricted
(
w
->
start
,
make_number
(
pos
),
w
->
buffer
);
w
->
start_at_line_beg
=
bolp
;
w
->
update_mode_line
=
Qt
;
XSETFASTINT
(
w
->
last_modified
,
0
);
XSETFASTINT
(
w
->
last_overlay_modified
,
0
);
/* If we scrolled forward, put point enough lines down
that it is outside the scroll margin. */
if
(
n
>
0
&&
this_scroll_margin
>
0
)
{
SET_PT
(
pos
);
Fvertical_motion
(
make_number
(
this_scroll_margin
),
window
);
pos
=
PT
;
}
if
(
pos
>
opoint
)
SET_PT
(
pos
);
{
SET_PT
(
pos
);
}
if
(
n
<
0
)
{
/* If we scrolled backward, put point near the end of the window
but not within the scroll margin. */
SET_PT
(
pos
);
tem
=
Fvertical_motion
(
make_number
(
ht
),
window
);
if
(
PT
>
opoint
||
XFASTINT
(
tem
)
<
ht
)
tem
=
Fvertical_motion
(
make_number
(
ht
-
this_scroll_margin
),
window
);
if
(
PT
>
opoint
||
XFASTINT
(
tem
)
<
ht
-
this_scroll_margin
)
SET_PT
(
opoint
);
else
Fvertical_motion
(
make_number
(
-
1
),
window
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment