* Added IndentString function to retrun the string used for indentation (n-spaces or a tab) based on buffer settings
* Combined redundant statements
* Removed duplicate leading whitespace check
* Better IndentString description
* Fixed remainder logic that I broke
* Bugfix: fix panic in MoveLinesUp when moving up the *last* line
* Bugfix: don't panic in Buffer.Line if index is out or range
* clean MoveLinesDown since it won't work for the last line anyway, add comment
* Cleanup: replace spaces with tabs in MoveLinesUp and MoveLinesDown
Previously the flag was parsed for `-cursor LINE,COL`
However, emacs and nano both us `+LINE,COL` and this also makes
it easier to ignore the `+` as a filename.
If you are editing a read-only file and forgot to open micro with sudo
so you could write to it, when saving the file, micro will now give you
the option to save with sudo.
This little hack is used by vim users to achieve the same behavior, but
micro makes it nicer to use. Here is an explanation for how it works:
http://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-workFixes#158
We use a diff to be able to transform the buffer into an arbitrary
string (usually when we reread the file after an external program such
as gofmt has changed it) and still preserve undo/redo.
Fixes#136
This adds the `savecursor` option which will remember where the cursor
was when the file was closed and put it back when the file is opened
again. The option is off by default so that people aren't confused as to
why the cursor isn't at the start of a file when they open it.
This commit also adds a more general ability to serialize a buffer so
various components can be saved (which could also be useful for persistent
undo).
Fixes#107
This is better design because the cursor and eventhandler are things the
buffer should know about directly but the view shouldn't. This should
make it easier to add persistent undo or location saving between
sessions (see #107).