Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         . . .
         Getting Text from a Buffer
         Spots
         Narrowing
         Undo Primitives
         Searching Primitives
         . . .
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
         Colors
      . . .

Previous   Up    Next
Spots  Primitives and EEL Subroutines   Undo Primitives


Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Buffer Primitives >

Narrowing

user buffer int narrow_start;
user buffer int narrow_end;
int narrow_position(int p)      /* buffer.e */

Epsilon provides two primitive variables, narrow_start and narrow_end, that restrict access to the current buffer. The commands narrow-to-region and widen-buffer, described in Miscellaneous, use these variables. Epsilon ignores the first narrow_start characters and the last narrow_end characters of the buffer. Usually, these variables have a value of zero, so no such restriction takes place. Characters outside of the narrowed region will not appear on the screen, and will remain outside the control of normal Epsilon commands.

If you try to set a primitive variable such as point to a position outside of the narrowed area, Epsilon will change the value to one inside the narrowed area. For example, suppose the buffer contains one hundred characters, with the first and last ten characters excluded, so only eighty appear on the screen. In this case, size( ) will return one hundred, and narrow_start and narrow_end will each have a value of ten. The statement point = 3; will give point a value of ten (the closest legal value), while the statement point = 10000; will give point the value ninety. Epsilon adjusts the parameters of primitive functions in the same way. Suppose, in the example above, you try to delete all the characters in the buffer, using the delete( ) primitive. Epsilon would take the statement delete(0, size()); and effectively change it to delete(10, 90); to delete only the characters inside the narrowed area.

The narrow_position( ) subroutine returns its argument p, adjusted so that it's inside the narrowed buffer boundaries.

Writing the buffer to a file ignores narrowing. Reading a file into the buffer lifts any narrowing in effect by setting narrow_start and narrow_end to zero.



Previous   Up    Next
Spots  Primitives and EEL Subroutines   Undo Primitives


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.