Liking cljdoc? Tell your friends :D

dk.salza.liq.slider

The slider is a basic construction resembling the most fundamental actions of a text edtior.

The slider is immutable, so every slider function in this namespace will take a slider as input together with some parameters and evaluate to a new slider.

By having the slider as first parameter a series of actions can be performed by using the threading operator "->", like:

(-> sl (end-of-line) (forward-char 3))

Some of the basic operations are:

  • Moving cursor
  • Inserting and removing content
  • Setting marks and moving cursor to marks
  • Marking regions

The sliderutil contains more slider related functions, which are more complex and usually composed of the basic functions in this file.

The slider is a basic construction resembling the most
fundamental actions of a text edtior.

The slider is immutable, so every slider function in this
namespace will take a slider as input together with some
parameters and evaluate to a new slider.

By having the slider as first parameter a series of actions
can be performed by using the threading operator "->",
like:

(->
  sl
  (end-of-line)
  (forward-char 3))

Some of the basic operations are:

* Moving cursor
* Inserting and removing content
* Setting marks and moving cursor to marks
* Marking regions

The sliderutil contains more slider related functions,
which are more complex and usually composed of the basic
functions in this file.
raw docstring

afterclj

(after sl)

Returns a slider with content after cursor.

Returns a slider with content after cursor.
sourceraw docstring

backward-visual-columnclj

(backward-visual-column sl columns column)

Moves the point backward one line, where the lines are wrapped. The parameter columns is how many chars are allowed on one line. The parameter column is the current selected column. The visual result of this function is the cursor will be located on the same column on the previous line, nomatter if the line was wrapped or not.

Moves the point backward one line, where
the lines are wrapped. The parameter columns is
how many chars are allowed on one line. The parameter
column is the current selected column.
The visual result of this function is the cursor will
be located on the same column on the previous line, nomatter
if the line was wrapped or not.
sourceraw docstring

beforeclj

(before sl)

Returns a slider with content before cursor.

Returns a slider with content before cursor.
sourceraw docstring

beginningclj

(beginning sl)

Moves the point (cursor) to the beginning of the slider.

Moves the point (cursor) to the beginning of the slider.
sourceraw docstring

beginning-of-lineclj

(beginning-of-line sl)

Moves the point to the beginning of the current line.

Moves the point to the beginning
of the current line.
sourceraw docstring

beginning?clj

(beginning? sl)

True if and only if the point is at the beginning of the slider.

True if and only if the point is at the
beginning of the slider.
sourceraw docstring

clearclj

(clear sl)

Erases everything in the slider, content and marks.

Erases everything in the slider,
content and marks.
sourceraw docstring

clear-marksclj

(clear-marks sl)

Removes all marks.

Removes all marks.
sourceraw docstring

createclj

(create)
(create text)

Creates a new slider with given text as text. The point will be placed at the beginning.

A slider basically consists of two lists:

before: A list of characters (strings) before the point, where the first element is the character just before the point. after: A list of characters (strings) after the point, where the first element is the character just after the point.

So moving the point is more or less to take characters from one of the lists and put into the other.

This text: abc|def

will look like this:

before = (c b a), after = (d e f).

Moving the curser to the right will result in:

before = (d c b a), after = (e f).
Creates a new slider with given text as text.
The point will be placed at the beginning.

A slider basically consists of two lists:

before: A list of characters (strings) before the point,
        where the first element is the character just before the point.
after:  A list of characters (strings) after the point,
        where the first element is the character just after the point.

So moving the point is more or less to take characters from one
of the lists and put into the other.

This text: abc|def

will look like this:

    before = (c b a), after = (d e f).

Moving the curser to the right will result in:

    before = (d c b a), after = (e f).
sourceraw docstring

deleteclj

(delete sl amount)

Deletes amount of characters to the left of the cursor. So delete 3 of aaabbb|ccc wil result in aaa|ccc.

Deletes amount of characters to the left of
the cursor. So delete 3 of
aaabbb|ccc wil result in
aaa|ccc.
sourceraw docstring

delete-lineclj

(delete-line sl)

Deletes the current line. The point will be placed at the beginning of the next line.

Deletes the current line.
The point will be placed at the beginning
of the next line.
sourceraw docstring

delete-regionclj

(delete-region sl markname)

Deletes the region between the given mark and the point. If the mark does not exist, nothing is deleted.

Deletes the region between the given
mark and the point. If the mark does
not exist, nothing is deleted.
sourceraw docstring

dirty?clj

(dirty? sl)
source

endclj

(end sl)

Moves the point to the end of the slider.

Moves the point to the end of the slider.
sourceraw docstring

end-of-lineclj

(end-of-line sl)

Moves the point to the end of the line. Right before the next line break.

Moves the point to the end of the line. Right before the
next line break.
sourceraw docstring

end?clj

(end? sl)

True if and only if the point is at the end of the slider.

True if and only if the point is at the
end of the slider.
sourceraw docstring

find-nextclj

(find-next sl search)

Moves the point to the next search match from the current point position.

Moves the point to the next search match
from the current point position.
sourceraw docstring

find-next-regexclj

(find-next-regex sl regex)

Find next regex match. If no match found ahead, position will be at end.

Find next regex match. If no match
found ahead, position will be at end.
sourceraw docstring

forward-lineclj

(forward-line sl)
(forward-line sl columns)
source

forward-visual-columnclj

(forward-visual-column sl columns column)

Moves the point forward one line, where the lines are wrapped. The parameter columns is how many chars are allowed on one line. The parameter column is the current selected column. The visual result of this function is the cursor will be located on the same column on the next line, nomatter if the line was wrapped or not.

Moves the point forward one line, where
the lines are wrapped. The parameter columns is
how many chars are allowed on one line. The parameter
column is the current selected column.
The visual result of this function is the cursor will
be located on the same column on the next line, nomatter
if the line was wrapped or not.
sourceraw docstring

forward-wordclj

(forward-word sl)

Moves the point to beginning of next word or end-of-buffer

Moves the point to beginning of next word or end-of-buffer
sourceraw docstring

get-after-listclj

(get-after-list sl)
source

get-charclj

(get-char sl)

Returns the first character after the point. If point is at the end of the slider, nil will be returned.

Returns the first character after the point.
If point is at the end of the slider, nil will
be returned.
sourceraw docstring

get-contentclj

(get-content sl)

The full content of the slider as text.

The full content of the slider as text.
sourceraw docstring

get-contextclj

(get-context sl)

Calculates a context object like a filepath, url, checkbox, code collapse and returns the type and the matched string. Output like {:type :file :value /tmp/tmp.txt}

Calculates a context object like
a filepath, url, checkbox, code
collapse and returns the type and
the matched string.
Output like {:type :file :value /tmp/tmp.txt}
sourceraw docstring

get-linenumberclj

(get-linenumber sl)

Return the linenumber of the point. It will always be equal to one more than the number of newline characters in ::before.

Return the linenumber of the point.
It will always be equal to one more
than the number of newline characters
in ::before.
sourceraw docstring

get-markclj

(get-mark sl name)

The position of the mark with the given name.

The position of the mark
with the given name.
sourceraw docstring

get-metaclj

(get-meta sl key)

Get a meta value from a char. If the value does not exist, nil will be returned.

Get a meta value from a char.
If the value does not exist, nil will be
returned.
sourceraw docstring

get-pointclj

(get-point sl)

Returns the point. If at the beginning of the slider the result is 0. If at the end of the slider the result is the number of characters.

Returns the point. If at the beginning of the
slider the result is 0. If at the end of the
slider the result is the number of characters.
sourceraw docstring

get-regionclj

(get-region sl markname)

Returns the content between the mark with the given name and the point. If there is no mark with the given name nil is returned.

Returns the content between the mark
with the given name and the point.
If there is no mark with the given name
nil is returned.
sourceraw docstring

get-region-as-sliderclj

(get-region-as-slider sl markname)
source

get-visible-contentclj

(get-visible-content sl)

This is not really in use yet, since there is not yet a hide lines functionality.

This is not really in use yet, since there
is not yet a hide lines functionality.
sourceraw docstring

get-visual-columnclj

(get-visual-column sl columns)
source

hidden?clj

(hidden? sl)

Checks if current position is a hidden region.

Checks if current position is a hidden
region.
sourceraw docstring

hide-regionclj

(hide-region sl markname)

Hides/collapses the given region: The content between the cursor and the given mark

Hides/collapses the given region:
The content between the cursor and the
given mark
sourceraw docstring

highlight-sexp-at-pointclj

(highlight-sexp-at-point sl)

Setting marks hl0 and hl1 on parenthesis matching the current s-expression for a view to use to highlight the the boundries of the s-expression.

Setting marks hl0 and hl1 on parenthesis matching the
current s-expression for a view to use to highlight the
the boundries of the s-expression.
sourceraw docstring

insertclj

(insert sl text)

Insert text at the point. The point will be moved to the end of the inserted text.

Insert text at the point. The point will be
moved to the end of the inserted text.
sourceraw docstring

insert-newlineclj

(insert-newline sl)

Special function to insert newline without too much overhead.

Special function to insert newline without too
much overhead.
sourceraw docstring

insert-sliderclj

(insert-slider sl1 sl2)

Insert second slider into first. Point is moved to match second slider. Marks are lost

Insert second slider into first.
Point is moved to match second slider.
Marks are lost
sourceraw docstring

insert-spaceclj

(insert-space sl)

Special funcon to insert a space without too much overhead.

Special funcon to insert a space without too
much overhead.
sourceraw docstring

insert-subsliderclj

(insert-subslider sl subsl)
source

is-newline?clj

(is-newline? c)

Check if \n or {:char \n}

Check if \n or {:char \n}
sourceraw docstring

leftclj

(left sl)
(left sl amount)

Moves the point to the left the given amount of times. So moving one character left is achieved with (left sl 1).

Moves the point to the left the given amount of times.
So moving one character left is achieved with
(left sl 1).
sourceraw docstring

left-untilclj

(left-until sl pred)

Moves the cursor backward, until for the current char: (pred char) is true. The cursor will be places just before the character. The function only mathces single characters, not character sequences! If there is no match, the cursor will move all the way to the beginning of the slider. Example (cursor = ^): aaacde^aacf -- left-until c --> aa^cdeaacf.

Moves the cursor backward, until for the current char:
(pred char) is true.
The cursor will be places just before the
character. The function only mathces single characters, not
character sequences!
If there is no match, the cursor will move all the way to the
beginning of the slider.
Example (cursor = ^):
  aaacde^aacf   -- left-until c -->   aa^cdeaacf.
sourceraw docstring

look-aheadclj

(look-ahead sl amount)

Returns char after the cursor given amount forward. If amount = 0 the char right after the cursor will be returned. If there is no result, nil is returned.

Returns char after the cursor given amount forward.
If amount = 0 the char right after the cursor will be
returned.
If there is no result, nil is returned.
sourceraw docstring

look-behindclj

(look-behind sl amount)

Returns char behind the cursor given amount back. If amount = 1 the char right behind the cursor will be returned. If there is no result, nil is returned.

Returns char behind the cursor given amount back.
If amount = 1 the char right behind the cursor will be
returned.
If there is no result, nil is returned.
sourceraw docstring

mark-paren-endclj

(mark-paren-end sl name)

Marks the paren-end of the current s-exp. In this case: aa (aa (aa|aa(aa)) The last paren will be selected.

Marks the paren-end of the
current s-exp. In this case:
aa (aa (aa|aa(aa))
The last paren will be selected.
sourceraw docstring

mark-paren-startclj

(mark-paren-start sl name)

Marks the paren-start of the current s-exp. In this case: aaa (aaa (aa) a|aa The first paren start is selected.

Marks the paren-start of the
current s-exp. In this case:
aaa (aaa (aa)  a|aa
The first paren start is selected.
sourceraw docstring

pad-rightclj

(pad-right sl columns)

Pad to the right with spaces

Pad to the right with spaces
sourceraw docstring

point-to-markclj

(point-to-mark sl name)

Moves the point to the mark with the given name. If the mark does not exist nothing is changed.

Moves the point to the mark
with the given name.
If the mark does not exist nothing
is changed.
sourceraw docstring

remove-markclj

(remove-mark sl name)

Removes the mark with the given name.

Removes the mark with the given name.
sourceraw docstring

(right sl)
(right sl amount)

Moves the point to the right (forward) the given amount of times.

Moves the point to the right (forward) the given amount of times.
sourceraw docstring

right-untilclj

(right-until sl pred)

Moves the cursor forward, until for the current char: (pred char) is true. The cursor will be placed just before the character. The function only matches single characters, not character sequences! If there is no match, the cursor will move all the way to the end of the slider. Example (cursor = ^): aaacde^aacf -- right-until c --> aacdeaa^cf.

Moves the cursor forward, until for the current char:
(pred char) is true.
The cursor will be placed just before the
character. The function only matches single characters, not
character sequences!
If there is no match, the cursor will move all the way to the
end of the slider.
Example (cursor = ^):
  aaacde^aacf   -- right-until c -->   aacdeaa^cf.
sourceraw docstring

select-sexp-at-pointclj

(select-sexp-at-point sl)

Selects the smallest valid s-expression containing the point (cursor position). The function take into account that the parenthesis should be balanced.

Selects the smallest valid s-expression containing
the point (cursor position). The function take into
account that the parenthesis should be balanced.
sourceraw docstring

set-dirtyclj

(set-dirty sl)
(set-dirty sl dirty)
source

set-markclj

(set-mark sl name)

Sets a named mark at the point. When inserting or deleting text strectly left to the mark, the mark will be moved accordingly.

Sets a named mark at the point.
When inserting or deleting text strectly left to
the mark, the mark will be moved
accordingly.
sourceraw docstring

set-metaclj

(set-meta sl key val)

Set a meta value on the current char. If char is a string it will be converted to a map.

Set a meta value on the current char.
If char is a string it will be converted to a map.
sourceraw docstring

set-pointclj

(set-point sl newpoint)

Moves point the the given location. Not further than beginning of the slider and the end of the slider.

Moves point the the given location.
Not further than beginning of the slider
and the end of the slider.
sourceraw docstring

sexp-at-pointclj

(sexp-at-point sl)

Returns the sexp at the current point. If there is no s-expression nil will be returned.

Returns the sexp at the current point. If there is no
s-expression nil will be returned.
sourceraw docstring

slide-marksclj

(slide-marks marks point amount)

This function will move marks strictly after point with the given amount. Marks at point will not be moved. When text is inserted, marks should be moved accordingly.

This function will move marks strictly after
point with the given amount.
Marks at point will not be moved.
When text is inserted, marks should be
moved accordingly.
sourceraw docstring

sliderclj

source

slider?clj

(slider? sl)

Returns true if the input has shape/properties like a slider.

Returns true if the input has shape/properties
like a slider.
sourceraw docstring

string-aheadclj

(string-ahead sl amount)

Returns next amount of chars as string.

Returns next amount of chars as string.
sourceraw docstring

swap-line-downclj

(swap-line-down sl)
source

swap-line-upclj

(swap-line-up sl)
source

take-linesclj

(take-lines sl rows columns)

Generate list of lines with at most columns chars. When exeeding end empty lines will be provided.

Generate list of lines with
at most columns chars. When exeeding
end empty lines will be provided.
sourceraw docstring

unhideclj

(unhide sl)

If current position contains hidden/collapsed content it will be expanded.

If current position contains hidden/collapsed
content it will be expanded.
sourceraw docstring

update-top-of-windowclj

(update-top-of-window sl rows columns tow)

Returns slider where cursor marks has been set and point moved to top of window.

Returns slider where cursor marks has been set
and point moved to top of window.
sourceraw docstring

wrapclj

(wrap sl columns)

Wrap all lines. Cursor will be at end.

Wrap all lines. Cursor will be at end.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close