# Functions
Decolorise strips a string of color.
Unlike the other functions in this file, which write the changed todos file back to disk, this one returns the new content as a byte slice.
Read a git-rebase-todo file, change the actions for the given commits, and write it back.
Compares two slices for equality.
EscapeSpecialChars - Replaces all special chars like \n with \\n.
returns the path of the file that calls the function.
Drop-in replacement for fuzzy.Find (except that it doesn't fill out MatchedIndexes or Score, but we are not using these).
Drop-in replacement for fuzzy.FindFrom (except that it doesn't fill out MatchedIndexes or Score, but we are not using these).
Returns comma-separated list of paths, with ellipsis if there are more than 3 e.g.
GetProjectRoot returns the path to the root of the project.
Loader dumps a string to be displayed as a loader.
used to keep a number n between 0 and max, allowing for wraparounds.
Removes the element at the 'fromIndex' and then inserts it at 'toIndex'.
Returns a new slice with the element at index 'from' moved to index 'to'.
Similar to a regular GroupBy, except that each item can be grouped under multiple keys, so the callback returns a slice of keys instead of just one key.
NewDummyLog creates a new dummy Log for testing.
NextIndex returns the index of the element that comes after the given number.
NextIntInCycle returns the next int in a slice, returning to the first index if we've reached the end.
NormalizeLinefeeds - Removes all Windows and Mac style line feeds.
returns two slices: the first is for elements that pass the test, the second for those that don't.
Pops item from the end of the slice and returns it, along with the updated slice Mutates original slice.
Prepends items to the beginning of a slice.
PrevIndex returns the index that comes before the given number, cycling if we reach the end.
PrevIntInCycle returns the prev int in a slice, returning to the first index if we've reached the end.
Removes the element at the given index.
defaults to left-aligning each column.
ResolvePlaceholderString populates a template with values.
Safe will close tcell if a panic occurs so that we don't end up in a malformed terminal state.
ScanLinesAndTruncateWhenLongerThanBuffer returns a split function that can be used with bufio.Scanner.Split().
Shifts item from the beginning of the slice and returns it, along with the updated slice.
SplitLines takes a multiline string and splits it on newlines currently we are also stripping \r's which may have adverse effects for windows users (but no issues have been raised yet).
TruncateWithEllipsis returns a string, truncated to a certain length, with an ellipsis.
formats the date in a smart way, if the date is today, it will show the time, otherwise it will show the date.
WithPadding pads a string as much as you want.
WrapError wraps an error for the sake of showing a stack trace at the top level the go-errors package, for some reason, does not return nil when you try to wrap a non-error, so we're just doing it here.
Wrap lines to a given width, and return: - the wrapped lines - the line indices of the wrapped lines, indexed by the original line indices - the line indices of the original lines, indexed by the wrapped line indices If wrap is false, the text is returned as is.