mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-19 23:37:13 +09:00
Added IndentString method on Buffer (#415)
* 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
This commit is contained in:
committed by
Zachary Yedidia
parent
766f836952
commit
fe0dce0960
@@ -182,6 +182,15 @@ func (b *Buffer) FileType() string {
|
||||
return b.Settings["filetype"].(string)
|
||||
}
|
||||
|
||||
// IndentString returns a string representing one level of indentation
|
||||
func (b *Buffer) IndentString() string {
|
||||
if b.Settings["tabstospaces"].(bool) {
|
||||
return Spaces(int(b.Settings["tabsize"].(float64)))
|
||||
} else {
|
||||
return "\t"
|
||||
}
|
||||
}
|
||||
|
||||
// CheckModTime makes sure that the file this buffer points to hasn't been updated
|
||||
// by an external program since it was last read
|
||||
// If it has, we ask the user if they would like to reload the file
|
||||
|
||||
Reference in New Issue
Block a user