guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two variables that are linked together by an heuristic (constraint p


From: Neil Jerram
Subject: Re: Two variables that are linked together by an heuristic (constraint programming?)
Date: Wed, 26 Apr 2017 11:01:49 +0100

Perhaps by making 'cursor' relative to 'view'?

Then you could always declare / assert that 

(>= cursor-x 0)
(< cursor-x (screen-width))
; and similarly for cursor-y

‎    Neil 


  Original Message  
From: Amirouche Boubekki
Sent: Tuesday, 25 April 2017 10:40
To: Guile User
Subject: Two variables that are linked together by an heuristic (constraint     
programming?)

Héllo!

In the editor I am working on, two variables are linked together.
That is the value of one depends on the value of the other.

There is a `view` position a cons of integers x and y which denotes
the top left position of the editor window in the buffer. Basically,
it defines the top left position of the rectangle of the visible part
of the buffer. The visible part of the buffer is called the viewport.

There is the `cursor` position which is also a cons of integers x
and y. The cursor defines the position of the cursor inside the
text buffer.

cursor and view are linked by the property that cursor must always
be inside the viewport, that is the visible part of the buffer.

Otherwise said, if the cursor is at the bottom of the view port,
and I hit 'down arrow' the viewport must scroll hence view's y must
be incremented. Similarly if I am at the top of the viewport and
I hit 'up arrow' the viewport must scroll.

I see that the cursor position is constrainted by the view (and the 
buffer). How can I express that in a nice and clean way?

-- 
Amirouche ~ amz3 ~ http://www.hyperdev.fr




reply via email to

[Prev in Thread] Current Thread [Next in Thread]