Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/model/editor/bufferModel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ end

--- @param sel integer
function BufferModel:set_selection(sel)
local max = self:get_content_length() + 1
if not sel or sel < 1 then sel = 1 end
if sel > max then sel = max end
self.selection = sel
end

Expand All @@ -258,7 +261,8 @@ function BufferModel:_get_selected_block()

local sel = self.selection
if sel == self:get_content_length() + 1 then
local ln = self.content:last().pos.fin + 1
local last = self.content:last()
local ln = (last and last.pos.fin or 0) + 1
return Empty(ln)
end
return self.content[sel]
Expand Down
1 change: 1 addition & 0 deletions src/model/editor/searchModel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Search = class.create(function(cfg)
input = UserInputModel(cfg, nil, false, 'search'),
searchset = {},
resultset = {},
selection = 1,
visible = ScrollableContent(0, 1, l)
}
end)
Expand Down
Loading