unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Two variables that are linked together by an heuristic (constraint programming?)
@ 2017-04-25  9:48 Amirouche Boubekki
  2017-04-26 10:01 ` Neil Jerram
  0 siblings, 1 reply; 2+ messages in thread
From: Amirouche Boubekki @ 2017-04-25  9:48 UTC (permalink / raw)
  To: Guile User

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Two variables that are linked together by an heuristic (constraint programming?)
  2017-04-25  9:48 Two variables that are linked together by an heuristic (constraint programming?) Amirouche Boubekki
@ 2017-04-26 10:01 ` Neil Jerram
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Jerram @ 2017-04-26 10:01 UTC (permalink / raw)
  To: Amirouche Boubekki, Guile User

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-26 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  9:48 Two variables that are linked together by an heuristic (constraint programming?) Amirouche Boubekki
2017-04-26 10:01 ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).