implemented visual ruler at config.line_limit

master
Alessandro Mauri 3 years ago
parent b74571e500
commit 9a367d6ed9
  1. 2
      TODO
  2. 7
      data/core/docview.lua
  3. 1
      src/main.c

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

@ -305,6 +305,10 @@ end
function DocView:draw_line_body(idx, x, y) function DocView:draw_line_body(idx, x, y)
local line, col = self.doc:get_selection() 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 -- draw selection if it overlaps this line
local line1, col1, line2, col2 = self.doc:get_selection(true) 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) self:draw_line_highlight(x + self.scroll.x, y)
end end
-- draw ruler
renderer.draw_rect(x + config.line_limit * sw, y, sw, lh, color)
-- draw line's text -- draw line's text
self:draw_line_text(idx, x, y) self:draw_line_text(idx, x, y)

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

Loading…
Cancel
Save