From 04d53ac5f45490df3b3f1ba0c3484cd38fcab552 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 15 Dec 2023 13:58:24 -0700 Subject: [PATCH] Add Scroll::new --- src/cursor.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cursor.rs b/src/cursor.rs index 84e80e3..fe44c8d 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -91,7 +91,7 @@ pub struct LayoutCursor { impl LayoutCursor { /// Create a new [`LayoutCursor`] - pub fn new(line: usize, layout: usize, glyph: usize) -> Self { + pub const fn new(line: usize, layout: usize, glyph: usize) -> Self { Self { line, layout, @@ -159,3 +159,10 @@ pub struct Scroll { /// if it is negative or exceeds the number of layout lines pub layout: i32, } + +impl Scroll { + /// Create a new cursor + pub const fn new(line: usize, layout: i32) -> Self { + Self { line, layout } + } +}