aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_litems.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/c_litems.go')
-rw-r--r--src/c_litems.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/c_litems.go b/src/c_litems.go
index 3f5a654..2b92816 100644
--- a/src/c_litems.go
+++ b/src/c_litems.go
@@ -82,6 +82,22 @@ func (litems *ItemsList) add_back(node *ItemsNode) {
litems.last = last.next
}
+// adds an item node to the list after the current selected item
+func (litems *ItemsList) add_after(node *ItemsNode) {
+ if litems.head == nil || litems.curr == nil {
+ litems.add_back(node)
+ return
+ }
+ curr := litems.curr
+ node.prev = curr
+ node.next = curr.next
+ curr.next = node
+ if litems.last == curr {
+ litems.last = node
+ }
+ litems.curr = node
+}
+
// removes an item node from the list and resets the ids
func (litems *ItemsList) del(item *ItemsNode) {
if litems.head == nil {
@@ -122,22 +138,6 @@ func (litems *ItemsList) del(item *ItemsNode) {
}
}
-// sets litems.curr to be used
-func (litems *ItemsList) sel(id int) {
- curr := litems.head
-
- if curr == nil {
- litems.curr = nil
- }
- for curr.next != nil && curr.ID != id {
- curr = curr.next
- }
- if curr.ID != id {
- litems.curr = nil
- }
- litems.curr = curr
-}
-
func (item *ItemsNode) is_dir() bool {
if item.Dirs == nil {
return false