github dheerajshenoy/lektra v0.8.0

5 hours ago

Breaking Changes

Some options were renamed to be consistent. The old names are ignored, so update your config.toml and Lua scripts:

Old New
window.menubar menubar.show
window.show_menu_icons menubar.icons
statusbar.visible statusbar.show
tabs.visible tabs.show
thumbnail.show_page_numbers thumbnail.page_numbers
outline.show_page_numbers outline.page_numbers
command_palette.show_shortcuts command_palette.shortcuts
llm_view.show_at_startup llm_view.at_startup

New Features

Lua scripting

  • New Lua View functions: history_stack() (the jump locations of a view), set_mark(char) and goto_mark(char) (marks, like the mark_set and mark_goto commands), image_metadata() (size, format, resolution and EXIF of an image), and scene_to_page(x, y) / page_to_scene(pageno, x, y) (between a point of the canvas and a point of a page).
  • New OnSynctexJumpRequested Lua event: called with the view, the source file, the line and the column when a SyncTeX jump from the PDF to its LaTeX source is requested.
  • New OnPresentationStarted and OnPresentationEnded Lua events, called when presentation mode is entered or left.
  • The Lua type stubs are now installed on Windows too (share\lektra\lua in the install folder), for completion when editing init.lua.

Options

  • New behavior.keep_view option (on by default): going to the next or previous page keeps the same part of the page in view, e.g. when zoomed into a region, instead of centering on the new page. Turn it off for the old behavior.
  • New laser_pointer.trail option: with the laser pointer, drawing with the left button leaves a trail that fades from its oldest end, like Excalidraw (trail_fade_ms sets the duration).
  • New outline.preload option: load the outline in the background after a document opens, instead of the first time the outline picker is opened (the default).
  • The picker keys can now be set from Lua: lektra.opt.picker.keys.down = {"Down", "Ctrl+N"} (the same actions as [picker.keys]).
  • Options of a view now work as in Vim: lektra.opt.<section>.<key> is :set (the default and the current view), the new lektra.opt_global is :setglobal (only the default), view:opt() is :setlocal (only that view), and the new view:opt_reset([section]) is :setlocal opt< (back to what a new view would have). A new split still starts with a copy of the options of the view it was made from.

Presentation mode

  • Presentation mode now works with clickers: PgDown, Space and the arrow keys go to the next page, PgUp and the arrow keys to the previous one (the arrows still move the caret in caret mode), F5 starts it and Esc leaves it. All other keys are disabled while it is on.
  • New [presentation] options: hide_cursor_ms, fullscreen, fit_mode, layout, show_statusbar, laser_on_start and allowed_actions. The fit mode is applied once the window is fullscreen.

Minimap

  • New minimap: while zoomed in on a page (a document or an image), a small overview of that page appears in a corner of the view with the visible area marked; click or drag in it to move there. The new [minimap] options set enabled, position (top_left, top_right, bottom_left, bottom_right), size, margin, opacity, border_color, border_width, the [minimap.viewport] table (color, width, fill, dim_color) for the box marking the visible area, render_page and animated (keep it updated while an animated image plays), and the toggle_minimap command shows or hides it.
  • New minimap.only_focused option: show the minimap only on the focused view, not on the other splits.

Images

  • New color_eyedrop command: a small color circle follows the pointer and shows the color under it and its hex value; click to copy the hex, Esc to cancel.
  • JPEG XL (.jxl) images, including animated ones, can now be opened if libjxl is installed on the system.
  • Optional libraries (librsvg, libexif, djvulibre, libjxl) are now found under any installed version. If one isn't found, set LEKTRA_LIB_RSVG, LEKTRA_LIB_CAIRO, LEKTRA_LIB_EXIF, LEKTRA_LIB_DJVU or LEKTRA_LIB_JXL to its path.

Tabs and views

  • New bibtex command copies the BibTeX entry of the paper you are reading to the clipboard. It finds the DOI in the PDF's metadata or first two pages (or an arXiv number) and fetches the entry with curl in the background.

  • New text underline mode (annot_underline_mode command, key 6, Tools → Mode → Text Underline): select text with the mouse and it is underlined when you release, like text highlight mode. The context menu of a selection has "Underline Text" too.

  • New ellipse (annot_ellipse_mode), polygon (annot_polygon_mode) and inline note (annot_note_mode) annotation modes (no default keys; the annotation edit mode is on 7). Drag for an ellipse or an inline note (text written on the page); click the corners of a polygon and double click, or click the first corner, to finish. Rectangle annotations are now outlines instead of filled.

  • Double clicking an annotation enters annotation edit mode with it selected (in the normal reading mode).

  • New image annotations: the annot_image command (annot_image [path], asks for the file if no path is given) places an image in the middle of the view, and "Insert Image Here..." in the right click menu places it at the pointer. In annotation edit mode an image can be moved, resized (corners keep the proportions, hold Shift to stretch) and turned with the handle above it (hold Shift to turn in steps of 15°). All of it can be undone and redone.

  • In annotation edit mode a selected rectangle, ellipse, polygon, inline note or popup can now be moved by dragging it, and all but the popup resized by its handles (hold Shift on a corner to keep the proportions). It can be undone.

  • New text squiggly underline (annot_squiggly_mode, squiggly_selection) and text strikeout (annot_strikeout_mode, strikeout_selection) annotations, made like highlights and underlines (Tools → Mode, or the context menu of a selection). They have no default keys; both are red unless you change the mode's color.

  • New redaction: annot_redact_mode (Tools → Mode, no default key) marks areas by dragging, and redact_apply permanently removes the text, images and drawings under the marks, after a confirmation. Applying cannot be undone, but nothing is written until you save; with annotations.redact.save_to_new_file (default on) you are asked where to save a redacted copy and the original file is left alone. Saving a redacted file always rewrites it completely, so the removed content is not kept in the file.

  • New behavior.save_mode option: overwrite (default) saves into the open file as before; ask asks for a new file on the first save, and suffix saves to name_annotated.ext next to the original (asking if that exists). The original is left alone, the view follows the new file and later saves go there.

  • New comment_selection command highlights the selected text and asks for a comment to attach to it.

  • New underline_selection command underlines the selected text. PDF has no setting for how an underline looks and MuPDF always draws it the same, so Lektra writes the underline's appearance itself: [annotations.underline] sets its color, thickness, offset (how far above the text) and style (solid, dashed or dotted). Underlines made by other programs are now also shown with hover and comments like highlights.

  • New grid layout: pages are laid out in rows of several columns (layout.mode = "grid", --layout grid, the layout_grid command or View → Layout → Grid). layout.grid_columns (default 3) sets the pages per row, and the grid_columns command changes it (grid_columns 4, grid_columns +1). Fit width fits the whole row, and next/previous page move by row.

  • New behavior.drag_image_out option (default on): set it to false to turn off dragging an image out of the page, if it gets in the way of selecting text. Text over an image (a scan with an OCR layer) can now be selected without turning it off.

  • New tabs.min_width and tabs.max_width options set the narrowest and widest a tab may be, in pixels (0: no limit); a longer title is shortened to fit.

  • New tabs.scroll_text_on_hover option: while the mouse is over a tab whose title does not fit, the title scrolls back and forth so all of it can be read (tabs at the top or bottom).

  • New split_to_windows and split_to_tabs commands move the splits of a tab (or of the selected tabs) into windows or tabs of their own, keeping the first split in place; "Move Splits to Separate Windows" is also in the tab menu. Lua: lektra.tabs.split_to_windows(), lektra.tabs.split_to_tabs() and, for one split, view:detach_to_window() / view:detach_to_tab().

  • Tab indices in Lua are now 1-based everywhere, like pages and Lua tables (Tab:index(), lektra.tabs.close/rename/select/selected/get_id, the indices lists, lektra.view.list(tab)); lektra.tabs.goto is now lektra.tabs.switch, because goto is a reserved word in Lua and could not be called as lektra.tabs.goto(...).

Documentation

  • The documentation is now on Read the Docs: installation, an example config.toml, and the commands, options and Lua API, generated from the sources so they match each release.

Bug Fixes

  • In single-instance mode, the window is now flagged as needing attention (urgent) when a file is opened in it from the command line, since the window manager may not bring it to the front.
  • In single-instance mode, dragging a tab out of the window (and the other "new window" actions) now opens a new window instead of reopening the file in the same one.
  • In single-instance mode, files given with a relative path (and the --synctex-forward paths) now open in the running instance.
  • Fit width going to the last page of the document
  • Fix an image drifting up and to the left when zooming in or out, until the view settled.
  • Color options set from Lua (lektra.opt and view:opt()) now accept a hex string such as "#1e1e2e", like config.toml does; before, only page.bg and page.fg did and the others needed an integer.
  • Fix scrollbars that are turned off (scrollbars.vertical / scrollbars.horizontal) showing up when zooming or resizing.
  • Scrolling no longer asks for a new render of pages that are already rendered on every small scrollbar movement.
  • Statusbar layout: a mistyped module or key is reported with a suggestion, an all-invalid layout falls back to the default one, and items placed with at no longer draw on top of each other.
  • Improved rendering performance when scrolling
  • Pages render faster: a pass over every page that changed nothing with the default page colours is skipped, and page colours, dark mode and high contrast are applied in one pass.
  • Fast scrolling and zooming waste less work: renders that are no longer needed stop early, pages are not preloaded while scrolling fast, and the page you land on is drawn first.
  • Fix a small memory leak when a page was dropped from the cache while it was being rendered.
  • Opening many files from the command line (lektra ~/Downloads/*.pdf) now only loads the first one and the others when you switch to them, as tabs.lazy_load says; before, every file was loaded at once.
  • Single-instance mode now works when it is turned on from init.lua (lektra.opt.behavior.single_instance), not only from config.toml or --single-instance, and a second instance no longer takes the socket away from a running one.
  • Right-clicking an annotation now shows its own menu instead of "Insert Image Here...".
  • Right-clicking a link now shows the link menu instead of "Insert Image Here...".
  • Fix a crash when closing the window with a portal open.
  • Fix the layout not updating after rotating or flipping a page, or toggling trimmed margins.
  • Auto-reload now says when the file was moved, renamed or deleted, instead of a generic "Could not reload the document".
  • Next/previous search match (with search.absolute_jump off) now works like vim: after scrolling, it jumps to the first match below the top of the view, or the last one above it, instead of skipping matches on the current page.

Don't miss a new lektra release

NewReleases is sending notifications on new releases.