Crops the component when its length longer than {max_length} option (if it's
specified).
Parameters:
* {str} (string) the current value of the component.
* {cmp} (table) the component object with follow options:
* max_length (number) the maximum count of symbols in the component,
after which the component will be cropped. If it's absent
or less or equal zero, the function returns nil. Default
to nil.
* crop (table) crop options:
* stub (string) a string which will be used instead of cropped
part. Default to '…'.
* side ('left' | 'right') a side from which a value will be
cropped. If absent, it will be calculated from the
component's section: for sections a,b,c a component value
will be cropped from the left; for sections x,y,z from the
right.
Return:
Original or cropped string.
This function is applied to the ex.git.branch component as the fmt function by default.
Fix of the ex.component
Reference to the component is passed to the fmt function.
Fix ex.git.branch component !
Fixed typo in {committed} option. This is breaking change!
Fix ex.cwd component
The count of symbols is used to follow the max_length options instead of the
count of bytes.
The new function
crop
Crops the component when its length longer than {max_length} option (if it's specified).
Parameters:
Return:
Original or cropped string.
This function is applied to the ex.git.branch component as the fmt function by default.
Fix of the
ex.component
Reference to the component is passed to the
fmt
function.Fix
ex.git.branch
component !Fixed typo in {committed} option. This is breaking change!
Fix
ex.cwd
componentThe count of symbols is used to follow the
max_length
options instead of the count of bytes.