Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Bug in Area

From: nitsch-lists:netcologne at: 2-Nov-2001 7:19

RE: [REBOL] Re: Bug in Area [brett--codeconscious--com] wrote:
> Excuse the butt in on this thread. I was drawn by the "big problem" phrase > ;-) > No major disagreements from me, but I don't think it is a bug. Perhaps just > a design issue or choice. > > I performed the following > > write clipboard:// mold get in ctx-text 'edit-text > > I believe edit-text is the function that handles quite a bit of the text > manipulationbehaviour of VID. > > Here's an except from that: > > paste-text [ > delete-selected-text > face/line-list: none > face/dirty?: true > view*/caret: insert view*/caret read clipboard:// > ] > > This is obviously the bit of code that handles a paste operation. As you can > see, the line-list is deliberately cleared. Also a dirty flag is set. I've > no idea what parts of View or Vid use these two variables, but if VID is > doing it perhaps you should too. >
i think face/line-list is a cache. if /view has to redraw the screen, it wants to know the part that is visible. if text is very long, calculating that can took time. think for example of using the scrollbar, redrawing occurs often. so the last calculation is stored, and the next drawings rely on this. if you change the text, recalculation is needed and view informed by [line-list: none]. with short texts recalculation is fast, so there is no need to use line-list. once i have read, its used > 200 chars. face/dirty? is set if you change the text. so you can check if face/dirty?[confirm "really exiting without saving?"] inbuild editor uses that for example.
> For me, reflecting on this little bit of code, I'd say that VID does not > have some support for programmers to update VID elements programmatically. > An example of support might be an "update" function on the face that when > called by a programmer would do all the necessary housekeeping for the VID > element. VID has focus. It targets a specific need. VID I think is meant as > a simple yet expressive way to create graphical interfaces quickly and as a > showoff for dialects. Not as a complete programmer level framework. The > needs of some programmers goes beyond what VID provides. >
opposition! ;-) view has your update in a way, but not that obvious. with view one sets some state-variables, which are then evaluated by show. this is from button/feel: redraw: func [face act pos /local state][ face/edge/effect: pick [ibevel bevel] face/state if face/texts [face/text: face/texts/1] all [face/state face/texts face/text: any [face/texts/2 face/texts/1]] state: either not face/state [face/blinker] [true] if face/colors [face/color: pick face/colors not state] if face/effects [face/effect: pick face/effects not state] ] 'redraw is called by show, just before painting. you see that it updates the show-related stuff based on other variables, like face/edge/effect: pick [ibevel bevel] face/state where effect is set based on face/state. the usual "update" triggers a lot of action by each change of a face-property. in rebol one can change various properties and action starts in the last possible moment, only one. more efficient and easier to track, but sometimes more code. i like it more :-) -Volker