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:
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.
(after sl)
Returns a slider with content after cursor.
Returns a slider with content after cursor.
(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.
(before sl)
Returns a slider with content before cursor.
Returns a slider with content before cursor.
(beginning sl)
Moves the point (cursor) to the beginning of the slider.
Moves the point (cursor) to the beginning of the slider.
(beginning-of-line sl)
Moves the point to the beginning of the current line.
Moves the point to the beginning of the current line.
(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.
(clear sl)
Erases everything in the slider, content and marks.
Erases everything in the slider, content and marks.
(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).
(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.
(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.
(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.
(end sl)
Moves the point to the end of the slider.
Moves the point to the end of the slider.
(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.
(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.
(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.
(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.
(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.
(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
(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.
(get-content sl)
The full content of the slider as text.
The full content of the slider as text.
(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}
(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.
(get-mark sl name)
The position of the mark with the given name.
The position of the mark with the given name.
(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.
(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.
(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.
(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.
(hidden? sl)
Checks if current position is a hidden region.
Checks if current position is a hidden region.
(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
(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.
(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.
(insert-newline sl)
Special function to insert newline without too much overhead.
Special function to insert newline without too much overhead.
(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
(insert-space sl)
Special funcon to insert a space without too much overhead.
Special funcon to insert a space without too much overhead.
(is-newline? c)
Check if \n or {:char \n}
Check if \n or {:char \n}
(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).
(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.
(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.
(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.
(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.
(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.
(pad-right sl columns)
Pad to the right with spaces
Pad to the right with spaces
(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.
(remove-mark sl name)
Removes the mark with the given name.
Removes the mark with the given name.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(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.
(slider? sl)
Returns true if the input has shape/properties like a slider.
Returns true if the input has shape/properties like a slider.
(string-ahead sl amount)
Returns next amount of chars as string.
Returns next amount of chars as string.
(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.
(unhide sl)
If current position contains hidden/collapsed content it will be expanded.
If current position contains hidden/collapsed content it will be expanded.
(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.
(wrap sl columns)
Wrap all lines. Cursor will be at end.
Wrap all lines. Cursor will be at end.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close