feat: implement scroll_view_center_cycle to replace cmd_cycle3
This commit is contained in:
		
							parent
							
								
									43c49125f8
								
							
						
					
					
						commit
						e172590ba8
					
				
					 13 changed files with 33 additions and 95 deletions
				
			
		|  | @ -1943,7 +1943,18 @@ pub const Editor = struct { | |||
|     pub fn scroll_view_center(self: *Self, _: Context) Result { | ||||
|         return self.scroll_view_offset(self.view.rows / 2); | ||||
|     } | ||||
|     pub const scroll_view_center_meta = .{ .description = "Scroll cursor to center/top/bottom of view" }; | ||||
|     pub const scroll_view_center_meta = .{ .description = "Scroll cursor to center of view" }; | ||||
| 
 | ||||
|     pub fn scroll_view_center_cycle(self: *Self, _: Context) Result { | ||||
|         const cursor_row = self.get_primary().cursor.row; | ||||
|         return if (cursor_row == self.view.row + scroll_cursor_min_border_distance) | ||||
|             self.scroll_view_bottom(.{}) | ||||
|         else if (cursor_row == self.view.row + self.view.rows / 2) | ||||
|             self.scroll_view_top(.{}) | ||||
|         else | ||||
|             self.scroll_view_offset(self.view.rows / 2); | ||||
|     } | ||||
|     pub const scroll_view_center_cycle_meta = .{ .description = "Scroll cursor to center/top/bottom of view" }; | ||||
| 
 | ||||
|     pub fn scroll_view_top(self: *Self, _: Context) Result { | ||||
|         return self.scroll_view_offset(scroll_cursor_min_border_distance); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue