implemented visual ruler at config.line_limit

This commit is contained in:
Alessandro Mauri 2021-07-04 22:33:24 +02:00
parent b74571e500
commit 9a367d6ed9
3 changed files with 8 additions and 2 deletions

2
TODO
View File

@ -31,5 +31,5 @@
[ ] add multi cursor system
[ ] add binding to open up a cheatsheet of keybinding, with a
search feature
[ ] implement visual "ruler" at column 80
[x] implement visual "ruler" at column 80
[ ] show hidden files config and binding

View File

@ -305,6 +305,10 @@ end
function DocView:draw_line_body(idx, x, y)
local line, col = self.doc:get_selection()
local sw = self:get_font():get_width(" ")
local w = math.ceil(1 * SCALE)
local lh = self:get_line_height()
local color = style.guide or style.selection
-- draw selection if it overlaps this line
local line1, col1, line2, col2 = self.doc:get_selection(true)
@ -324,6 +328,9 @@ function DocView:draw_line_body(idx, x, y)
self:draw_line_highlight(x + self.scroll.x, y)
end
-- draw ruler
renderer.draw_rect(x + config.line_limit * sw, y, sw, lh, color)
-- draw line's text
self:draw_line_text(idx, x, y)

View File

@ -65,7 +65,6 @@ int main(int argc, char **argv)
init_window_icon();
ren_init(window);
lua_State *L = luaL_newstate();
luaL_openlibs(L);
api_load_libs(L);