Revert "ui.gadgets.editors: add editor-constrained-dim function to editor"
This reverts commit 16381beddc.
			
			
				char-rename
			
			
		
							parent
							
								
									fdcbf0d110
								
							
						
					
					
						commit
						dcae1baad5
					
				| 
						 | 
					@ -6,7 +6,7 @@ documents.elements fry grouping kernel locals make math
 | 
				
			||||||
math.functions math.order math.ranges math.rectangles
 | 
					math.functions math.order math.ranges math.rectangles
 | 
				
			||||||
math.vectors models models.arrow namespaces opengl sequences
 | 
					math.vectors models models.arrow namespaces opengl sequences
 | 
				
			||||||
sorting splitting timers ui.baseline-alignment ui.clipboards
 | 
					sorting splitting timers ui.baseline-alignment ui.clipboards
 | 
				
			||||||
ui.commands ui.gadgets ui.gadgets.borders strings
 | 
					ui.commands ui.gadgets ui.gadgets.borders
 | 
				
			||||||
ui.gadgets.line-support ui.gadgets.menus ui.gadgets.scrollers
 | 
					ui.gadgets.line-support ui.gadgets.menus ui.gadgets.scrollers
 | 
				
			||||||
ui.theme ui.gestures ui.pens.solid ui.render ui.text
 | 
					ui.theme ui.gestures ui.pens.solid ui.render ui.text
 | 
				
			||||||
unicode ;
 | 
					unicode ;
 | 
				
			||||||
| 
						 | 
					@ -213,36 +213,6 @@ M: editor draw-gadget*
 | 
				
			||||||
        [ draw-lines ] [ draw-caret ] bi
 | 
					        [ draw-lines ] [ draw-caret ] bi
 | 
				
			||||||
    ] with-variable ;
 | 
					    ] with-variable ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<PRIVATE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: row,col-dim ( font r c -- dim )
 | 
					 | 
				
			||||||
    CHAR: x <string> swap
 | 
					 | 
				
			||||||
    CHAR: \n <string>
 | 
					 | 
				
			||||||
    append text-dim ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: min-dim ( font editor -- dim )
 | 
					 | 
				
			||||||
    [ min-rows>> [ 0 ] unless* ]
 | 
					 | 
				
			||||||
    [ min-cols>> [ 0 ] unless* ] bi
 | 
					 | 
				
			||||||
    row,col-dim ;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
: max-dim ( font editor -- dim )
 | 
					 | 
				
			||||||
    ! hopefully no one goes over 5000
 | 
					 | 
				
			||||||
    [ max-rows>> [ 5000 ] unless* ]
 | 
					 | 
				
			||||||
    [ max-cols>> [ 5000 ] unless* ] bi
 | 
					 | 
				
			||||||
    row,col-dim ;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
: txt-dim ( font editor -- dim )
 | 
					 | 
				
			||||||
    control-value text-dim ;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
PRIVATE>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: editor-constrained-dim ( editor -- dim )
 | 
					 | 
				
			||||||
    [ font>> ] keep
 | 
					 | 
				
			||||||
    [ max-dim ]
 | 
					 | 
				
			||||||
    [ txt-dim ]
 | 
					 | 
				
			||||||
    [ min-dim ] 
 | 
					 | 
				
			||||||
    2tri vmax vmin { 1 0 } v+ ;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
M: editor pref-dim*
 | 
					M: editor pref-dim*
 | 
				
			||||||
    ! Add some space for the caret.
 | 
					    ! Add some space for the caret.
 | 
				
			||||||
    [ font>> ] [ control-value ] bi text-dim { 1 0 } v+ ;
 | 
					    [ font>> ] [ control-value ] bi text-dim { 1 0 } v+ ;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue