mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 07:45:30 +03:00
remove use of substr, cleanup hungry backspace
This commit is contained in:
parent
58e8ba1ad6
commit
8067084340
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
|
||||
tests/
|
||||
phi-editor
|
||||
phi
|
||||
|
@ -541,8 +541,12 @@ func (b *Buffer) deletePrev() {
|
||||
// cut out the last {TAB_SIZE} amount of characters
|
||||
// and check em
|
||||
tabSize := int(b.cfg.Editor.Tab_Size)
|
||||
lastTabSizeChars := b.table.Lines[b.curs.y].Substr(b.curs.x+1-tabSize, tabSize)
|
||||
if strings.Compare(lastTabSizeChars, b.makeTab()) == 0 {
|
||||
|
||||
// render the line...
|
||||
currLine := b.table.Lines[b.curs.y].String()
|
||||
before := currLine[b.curs.x-tabSize:]
|
||||
|
||||
if strings.HasPrefix(before, b.makeTab()) {
|
||||
// delete {TAB_SIZE} amount of characters
|
||||
// from the cursors x pos
|
||||
for i := 0; i < int(b.cfg.Editor.Tab_Size); i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user